ChildList() of FORM ?

Discuss anything else that does not suite other forums.

Moderator: Rathinagiri

User avatar
AUGE_OHR
Posts: 2096
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

ChildList() of FORM ?

Post by AUGE_OHR »

hi,

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] )
have fun
Jimmy
User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

Re: ChildList() of FORM ?

Post by SALINETAS24 »

Hola, igual es esto lo que buscas

<WindowName>.FocusedControl

Sl2
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
User avatar
AUGE_OHR
Posts: 2096
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: ChildList() of FORM ?

Post by AUGE_OHR »

hi,
SALINETAS24 wrote: Tue Dec 17, 2019 7:20 am Hola, igual es esto lo que buscas

Code: Select all

<WindowName>.FocusedControl
thx for Tip
FocusedControl Property
Retrieves the focused control name of a Window
my Problem that i want to SET focus to a Child Control ... i exist

Code: Select all

   nPosi := ASCAN(aChild, {|e| e = MySeekControl } )
   IF nPosi > 0
      SetAppFocus( aChild[nPosi] )
most it is the 1St Child but i need a "List" of all Child to work with
have fun
Jimmy
User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

Re: ChildList() of FORM ?

Post by SALINETAS24 »

Hola.., siento no entender lo que buscas.
Creo entender que necesitas la lista de controles o de Child que tienes.., quizas esto te pueda poner sobre la pista...

viewtopic.php?f=24&t=5805&p=56314&hilit ... LES#p56314

Un saludo,
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: ChildList() of FORM ?

Post by andyglezl »

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
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
AUGE_OHR
Posts: 2096
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: ChildList() of FORM ?

Post by AUGE_OHR »

YES :D

i found this

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 aControls
now i have to find out how to use it ...

thx all for help
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2096
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: ChildList() of FORM ?

Post by AUGE_OHR »

andyglezl wrote: Wed Dec 18, 2019 1:45 am

Code: Select all

In each DEFINE...
	FOR i = 1 TO HMG_LEN( aChildForms )
thx for help.

Question : is HMG_LEN() different to LEN() function :?:
have fun
Jimmy
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: ChildList() of FORM ?

Post by andyglezl »

HMG_LEN() = Unicode
LEN() = ANSI
Andrés González López
Desde Guadalajara, Jalisco. México.
edk
Posts: 999
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: ChildList() of FORM ?

Post by edk »

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
@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:

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
Sample:
GetWindowsByType.7z
(1.49 KiB) Downloaded 191 times
Edward.
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: ChildList() of FORM ?

Post by andyglezl »

@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.
Hola EDK

(Lo siento, me enfoque en lo que yo estaba haciendo...)

Tienes razón, aunque si estoy controlando el cierre de las ventanas.
En mi caso, solo guardo algunos datos de las ventanas CHILD (no todas) que voy creando
en esa opción del programa para poderlos utilizar mas delante hasta el cierre de la misma.
(de hecho, lo estoy utilizando con tu ejemplo) https://www.hmgforum.com/viewtopic.php? ... 9&start=10
*-----------------------------------------------------------------------------------------------------------------------------------------
Hi EDK

(I'm sorry, I focus on what I was doing ...)

You are right, although I am controlling the closing of the windows.
In my case, only save some data from the CHILD windows (not all) that I am creating
in that option of the program to be able to use them more ahead until the closing of the same.
(in fact, I'm using it with your example) https://www.hmgforum.com/viewtopic.php? ... 9&start=10

Gracias por esta nueva herramienta que nos compartes !
*-------------------------------------------------------------------------
Thank you for this new tool that you share with us!
Andrés González López
Desde Guadalajara, Jalisco. México.
Post Reply