a FORM have OnGotFocus() which i want to re-direct to set focus on 1st Child, how with HMG
under Xbase++ i use
Code: Select all
aChild := oDialog:DrawingArea:ChildList()
SetAppFocus( aChild[1] )
Moderator: Rathinagiri
Code: Select all
aChild := oDialog:DrawingArea:ChildList()
SetAppFocus( aChild[1] )
thx for TipSALINETAS24 wrote: ↑Tue Dec 17, 2019 7:20 am Hola, igual es esto lo que buscas
Code: Select all
<WindowName>.FocusedControl
my Problem that i want to SET focus to a Child Control ... i existFocusedControl Property
Retrieves the focused control name of a Window
Code: Select all
nPosi := ASCAN(aChild, {|e| e = MySeekControl } )
IF nPosi > 0
SetAppFocus( aChild[nPosi] )
Code: Select all
In each DEFINE...
AADD( aChildForms, { nForm, cChildForm, cPanelForm, .T. } )
Validate...
FOR i = 1 TO HMG_LEN( aChildForms )
IF hb_AScan( aChildForms[i] , cNombChild2Focus, .T. ) > 0
DoMethod( cNombChild2Focus, "SetFocus")
EXIT
ENDIF
NEXT i
Code: Select all
Function GetControls( cForm )
Local hWnd := GetFormHandle( cForm )
Local aControls := {} //List of controls {ControlType, ControlName}
AEVAL( _HMG_SYSDATA[ 4 ], { | hCtrWnd, nPos | IF( hCtrWnd == hWnd, AADD( aControls , { _HMG_SYSDATA[ 1, nPos ], _HMG_SYSDATA[ 2, nPos ] }), Nil ) } )
MsgDebug( 'List of controls', aControls)
Return aControlsthx for help.andyglezl wrote: ↑Wed Dec 18, 2019 1:45 amCode: Select all
In each DEFINE... FOR i = 1 TO HMG_LEN( aChildForms )
@andyglezl It will not be correct, because you would have to handle the window closing event and remove it from the aChildForms array.andyglezl wrote: ↑Wed Dec 18, 2019 1:45 am Maybe...
Code: Select all
In each DEFINE... AADD( aChildForms, { nForm, cChildForm, cPanelForm, .T. } ) Validate... FOR i = 1 TO HMG_LEN( aChildForms ) IF hb_AScan( aChildForms[i] , cNombChild2Focus, .T. ) > 0 DoMethod( cNombChild2Focus, "SetFocus") EXIT ENDIF NEXT i
Code: Select all
Function GetWindowsByType( cType )
Local aForms := {} //List of forms { WindowName, WindowType, WindowIsDeleted, WindowIsActive, WindowHandle, WindowParentHandle }
Default cType :=''
/*
empty - all types
A - main
S - standard
C - child
M - modal
P - panel
X - splitchild
*/
IF Upper(Left(cType,1))$"ASCMPX" .OR. EMPTY( cType )
AEVAL( _HMG_SYSDATA[ 69 ], { | cWndType, nPos | IF( Empty( cType ) .OR. cWndType==Upper(Left (cType, 1)) , ;
AADD( aForms , ;
{ _HMG_SYSDATA[ 66, nPos ], ; //_HMG_aFormName
_HMG_SYSDATA[ 69, nPos ], ; //_HMG_aFormType
_HMG_SYSDATA[ 65, nPos ], ; //_HMG_aFormDeleted
_HMG_SYSDATA[ 68, nPos ], ; //_HMG_aFormActive
_HMG_SYSDATA[ 67, nPos ], ; //_HMG_aFormHandle
_HMG_SYSDATA[ 70, nPos ]}),; //_HMG_aFormParentHandle
Nil ) } )
ELSE
MsgStop('Function GetWindowsByType(): invalid window type "' + cType + '"' )
ENDIF
Return aForms
Hola EDK@andyglezl It will not be correct, because you would have to handle the window closing event and remove it from the aChildForms array.
If you want to check for instances of a given window type, you can use this function:
Edward.