Hi friends
I found a way to handle TABSTOP (and related usage of TAB, SHIFT+TAB, ENTER and Click on the field).
Basically, I have introduced for "all objects usage of FocusIn and FocusOut events (see __HmgconnetcEv() and related __HmgDisconnectEv() methods in BASIC class) like Close event. In this way some shared vars (s_oCurWindow and s_oCurWidget) are also valorized and they contain "focused/current" HMG4 object; some methods handle their value like THISWINDOW, THISWIDGET (new method to know the current control/widget) and THIS (aligned with HMG3 doc: it can returnes the current widget focused or if not the current window focused).
Now you can go around for all the widget in a form if it has TABSTOP setting up to .T.; this is the default value for all the objects. In the future, we can customized to .F. for some objects like LABEL, BITMAP, simply add ::lTabStop := .F. into their New() method.
At the same time, I do some changes in textbox (I hope a good changes, but they must be tested because I discovered some problems with TEXTBOX) about connected events and related connecting system. For example: I changed from textedit() to textchanged() because the OnChange method it doesn't works. I change from returnPressed() to editingFinished() to handle the OnEnter... and I think we must use ::oQtObject:disconnect( "textChanged(QString)" ) within
__HmgTextChange() to prevent unusefull sending event in this way
Code: Select all
METHOD __HmgTextChange( cText ) CLASS TEXTBOX
LOCAL icp, InBufferLeft, InBufferRight, InBuffer
HB_SYMBOL_UNUSED( cText )
::oQtObject:disconnect( "textChanged(QString)" ) <=== new
...............
Eval( ::bOnChange )
ENDIF
ENDIF
ENDIF
::oQtObject:connect( "textChanged(QString)", { |cText| ::__HmgTextChange(cText) } ) <=== new
RETURN NIL
Realted with my other thread and Ricci, I say again: the current method/system to compile end programs and library it's not very "clear". With alternate method
http://hmgforum.com/viewtopic.php?f=32&t=2175 some functions work again but other (checked() method) no. Please take a look to my previous post and try by your self what happens.
Code: Select all
2011-11-23 09:00 UTC+0100 Luigi Ferraris ( <luigi at l3w.it> )
! include/hmg.ch
! changed THISWINDOW command in according with new ThisWin()
+ THISWIDGET command in according with ThisWdg()
! THIS command in according with ThisW()
! source/bitmap.prg
! source/statusbar.prg
! source/timer.prg
! source/tree.prg
! source/waitwin.prg
! revised __HmgConnectEv() and __HmgDisconnectEv() methods
! source/textbox.prg
! ProcessEnter() renamed into __HmgOnEnterExec().
! ProcessTextChange() renamed into __HmgTextChange
! ProcessTextBoxGotFocus() renamed into __HmgOnGotFocusExec
! ProcessTextBoxLostFocus() renamed into __HmgOnLostFocusExec
- removed OnGotFocus() and OnLostFocus() methods: already defined in
BASIC class.
- removed OnChange() method: already defined in CONTROL class.
! source/virtualwindow.prg
- removed OnGotFocus() and OnLostFocus() methods: already defined in
BASIC class.
+ __HmgConnectEv() and __HmgDisconnectEv() related with focus events
connected by default
* renamed __HmgOnFocusInExec() into __HmgOnGotFocusExec
* renamed __HmgOnFocusOutExec() into __HmgOnLostFocusExec
* source/basic.prg
+ lTabStop (by default is .T.) and TabStop() method to handle movements
around widgets on form. For some widgets (like LABEL) it will be .F.
+ __HmgOnGotFocusExec() and __HmgOnLostFocusExec()
! QEvent_FocusIn and QEvent_FocusOut events are connected/disconnected by
default as QEvent_Close. See related __HmgConnectEv() and
__HmgDisconnectEv(). Now, OnGotFocus() and OnLostFocus() methods only
managed related var (bOnGotFocus and bOnLostFocus).
+ OnGotFocus() and OnLostFocus() methods in according with: "these events
are connected/disconnected internally by default"
* source/hmgapp.prg
+ ThisW() method return focused widget/control if ::s_oCurWidget is
NOT NIL else ::sCurWindow is returned
+ ThisWin() method return current/focused Hmg Window
+ ThisWdg() method return focused widget/control else NIL. Please
pay attention: it can be return NIL.
- CurrHmgWin() method unuseful. Instead you must use ThisWin().
* source/globshared.prg
* source/hmgapp.prg
+ s_oCurWidget shared data to stores the current focused widget. It will
be valorized when receives focus (see __HmgOnGotFocusExec) and will be
reset (NIL) when loose focus (see __HmgOnLostFocusExec)
! source/control.prg
- lTabStop data and TabStop() method. Moved into BASIC class
- OnGotFocus() and OnLostFocus() methods moved into BASIC class
- __HmgOnGotFocusExec() and __HmgOnLostFocusExec()
! OnChange() method
Cheers