Page 1 of 2

Label control focus

Posted: Thu May 14, 2020 6:58 am
by karweru
Dear all,

If one clicked on a label, any way to get _getFocusedControl (<windowName>) return the label's control name? I'am getting nil from _getfocusedcontrol()

Any other way to achieve this?

Re: Label control focus

Posted: Thu May 14, 2020 7:17 am
by serge_girard
Hello Gilbert,
I use this in order to bloc all controls:

Code: Select all

aCtrls := _GetArrayOfAllControlsForForm( "Form_1" )
FOR A = 1 TO LEN(aCtrls)
   IF 'BUTTON' $ UPPER(aCtrls [A] [2])  .OR. 'MENU' $ UPPER(aCtrls [A] [2]) .OR. 'COMBO' $ UPPER(aCtrls [A] [2]  )
      SetProperty('Form_1' , aCtrls [A] [1] ,  'Enabled', .f.)
   ENDIF
NEXT
Serge

Re: Label control focus

Posted: Thu May 14, 2020 9:42 pm
by mol
I think labels have no focus.

Re: Label control focus

Posted: Fri May 15, 2020 12:21 am
by AUGE_OHR
hi,
serge_girard wrote:
Thu May 14, 2020 7:17 am

Code: Select all

aCtrls := _GetArrayOfAllControlsForForm( "Form_1" )
as i know

Code: Select all

_GetArrayOfAllControlsForForm()
is a MiniGUI Extended Function ... does it work with HMG :?:

Re: Label control focus

Posted: Fri May 15, 2020 12:23 am
by AUGE_OHR
try this

Code: Select all

LOCAL nCol, nRow, hWnd
LOCAL cControl := ""
LOCAL cForm := ""

   GetCursorPos (@nCol, @nRow)
   hWnd := WindowFromPoint (nCol, nRow)
   GetControlNameByHandle( hWnd, @cControl, @cForm )

Re: Label control focus

Posted: Fri May 15, 2020 4:54 pm
by karweru
Thank you all,

Will try the suggestions.

Re: Label control focus

Posted: Wed Jul 01, 2020 7:38 pm
by srvet_claudio
Hi,
see OnClick propr:

Label ... OnClick <ActionProcedureName>

Re: Label control focus

Posted: Wed Jul 01, 2020 8:18 pm
by mol
Welcome back, Claudio

Re: Label control focus

Posted: Wed Jul 01, 2020 8:31 pm
by serge_girard
+10 Yes, Claudio , wellcome back!!
Serge

Re: Label control focus

Posted: Wed Jul 01, 2020 9:32 pm
by srvet_claudio
Thanks friends!!!
But I'm kind of rusty with Windows programming :lol: :lol: :lol: