Topic Specific Tutorials and Tips.
Moderator: Rathinagiri
srvet_claudio
Posts: 2193 Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:
Post
by srvet_claudio » Thu Jul 11, 2013 11:22 pm
Wow Carlos, nice idea.
but with the new functions of HMG the code is more simple.
Code: Select all
#include "hmg.ch"
Function Main
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 640 HEIGHT 480 ;
TITLE 'HMG Demo' ;
ICON 'DEMO.ICO' ;
MAIN
@ 30,10 EDITBOX Edit_1 ;
WIDTH 410 ;
HEIGHT 140 ;
VALUE 'EditBox!!';
MAXLENGTH 0 // same as --> SendMessage (GetControlHandle("Edit_1","Form_1"), 197, 0, 0 )
DEFINE BUTTON D
ROW 250
COL 290
WIDTH 130
CAPTION '_GetCaretPos'
ACTION MsgInfo (Form1.Edit_1.CaretPos) // ---> MsgInfo() --> convert xData to STR
END BUTTON
END WINDOW
// CREATE EVENT PROCNAME OnkeyEdit_1() HWND GetControlHandle("Edit_1","Form_1") // --> Work only with Form1.Edit_1
CREATE EVENT PROCNAME OnkeyAllEditBox() // --> Work with all EditBox controls
Form_1.Center()
Form_1.Activate()
Return Nil
Function OnkeyEdit_1()
IF EventMSG() == WM_CHAR
IF .NOT. (GetKeyState(VK_INSERT) == 0) .AND. HMG_GetLastVirtualKeyDown() != VK_RETURN .AND. HMG_GetLastVirtualKeyDown() != VK_BACK
SendMessage (EventHWND(), WM_KEYDOWN, VK_DELETE, 0)
ENDIF
ENDIF
Return NIL
Function OnkeyAllEditBox()
LOCAL nIndex := GetControlIndexByHandle (EventHWND())
IF nIndex > 0 .AND. GetControlTypeByIndex (nIndex) == "EDIT"
IF EventMSG() == WM_CHAR
IF .NOT. (GetKeyState (VK_INSERT) == 0) .AND. HMG_GetLastVirtualKeyDown() != VK_RETURN .AND. HMG_GetLastVirtualKeyDown() != VK_BACK
SendMessage (EventHWND(), WM_KEYDOWN, VK_DELETE, 0)
ENDIF
ENDIF
ENDIF
Return NIL
Pablo César
Posts: 4059 Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Post
by Pablo César » Fri Jul 12, 2013 12:07 am
Uhmm looks promising solution...
Thanks Carlos and Claudio !
Hi dear Claudio, in your example are missing these functions:
EVENTMSG
HMG_GETLASTVIRTUALKEYDOWN
EVENTHWND
GETCONTROLINDEXBYHANDLE
GETCONTROLTYPEBYINDEX
I assume that will be available in the next release, but could you please anticipate to all of us ?
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Pablo César
Posts: 4059 Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Post
by Pablo César » Fri Jul 12, 2013 12:22 am
I do not know what the rest of his colleagues opine, but IMHO this new option of OVERWRITE in EDIT controls by key pressed, could be incorporated into the function INITEDITBOX C:\hmg.3.1.4\SOURCE\c_editbox.c adding a new property (a new parameter) as an option for the programmer.
Something like this:
DEFINE EDITBOX Edit_1
ROW 30
COL 10
WIDTH 500
HEIGHT 140
VALUE "EditBox!!"
OVERWRITE .T.
..//..
END EDITBOX
And this routine of key control would be only activated if OVERWRITE is .T.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
srvet_claudio
Posts: 2193 Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:
Post
by srvet_claudio » Fri Jul 12, 2013 1:11 am
Pablo César wrote: Uhmm looks promising solution...
Thanks Carlos and Claudio !
Hi dear Claudio, in your example are missing these functions:
EVENTMSG
HMG_GETLASTVIRTUALKEYDOWN
EVENTHWND
GETCONTROLINDEXBYHANDLE
GETCONTROLTYPEBYINDEX
I assume that will be available in the next release, but could you please anticipate to all of us ?
Yes, these are functions of the new version.
Pablo César wrote: I do not know what the rest of his colleagues opine, but IMHO this new option of OVERWRITE in EDIT controls by key pressed, could be incorporated into the function INITEDITBOX C:\hmg.3.1.4\SOURCE\c_editbox.c adding a new property (a new parameter) as an option for the programmer.
Later I will try to develop a real routine overwriting.
Carlos Britos
Posts: 245 Joined: Sat Aug 02, 2008 5:03 pm
Post
by Carlos Britos » Sat Jul 13, 2013 11:38 pm
srvet_claudio wrote:
Code: Select all
@ 30,10 EDITBOX Edit_1 ;
WIDTH 410 ;
HEIGHT 140 ;
VALUE 'EditBox!!';
MAXLENGTH 0 // same as --> SendMessage (GetControlHandle("Edit_1","Form_1"), 197, 0, 0 )
Hello Claudio
I was looking at the example code and the option "MaxLenght = 0" would invalidate the use of that property for text.
Regards/Saludos, Carlos (bcd12a)
Carlos Britos
Posts: 245 Joined: Sat Aug 02, 2008 5:03 pm
Post
by Carlos Britos » Sun Jul 14, 2013 3:16 am
Carlos Britos wrote:
I was looking at the example code and the option "MaxLenght = 0" would invalidate the use of that property for text.
Forget it, I'm wrong.
Los penales no me dejaron pensar claro.
Regards/Saludos, Carlos (bcd12a)
srvet_claudio
Posts: 2193 Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:
Post
by srvet_claudio » Sun Jul 14, 2013 4:36 am
Carlos Britos wrote: Los penales no me dejaron pensar claro.
Los penales errados hoy contra Francia y en la Copa de las Confederaciones contra Italia no me dejan dormir.
Pero como dijo hoy un colombiano en la pagina web de la FIFA: "pa´lante uruguayos, vamos que el segundo es el mejor entre los perdedores"
EduardoLuis
Posts: 683 Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina
Post
by EduardoLuis » Wed Jul 24, 2013 4:05 pm
Hi Friends:
Did you consider where you'll store EditBox contents ?
Take notice of this:
*.txt file: Max. 65535 char
memo Field: Max. 29958 (aprox.)
To solve storage problem using large Editbox contents, you must split text on portions which it size matches with storage output.-
esgici
Posts: 4543 Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:
Post
by esgici » Wed Jul 24, 2013 4:22 pm
EduardoLuis wrote:
Take notice of this:
*.txt file: Max. 65535 char
memo Field: Max. 29958 (aprox.)
To solve storage problem using large Editbox contents, you must split text on portions which it size matches with storage output.-
Hello Eduardo
As far as I know text limit is for Clipper and memo field limit is for DBFNTX.
In Window environment and by using Harbour and DBFCDX will be everything OK
( hopefully
)
There will be other limits, but I couldn't reached yet
Happy HMG'ing
Viva
INTERNATIONAL HMG
EduardoLuis
Posts: 683 Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina
Post
by EduardoLuis » Wed Jul 24, 2013 4:58 pm
Hi Esguici:
I've tested limits with HMG DBFNTX.-
Now i'll test limits with HMG DBFCDX.-
Thanks for you suggestion.-
Eduardo.-