Label control focus

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
karweru
Posts: 220
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Contact:

Label control focus

Post 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?
Kind regards,
Gilbert.
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Label control focus

Post 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
There's nothing you can do that can't be done...
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Label control focus

Post 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 :?:
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Label control focus

Post 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 )
have fun
Jimmy
User avatar
karweru
Posts: 220
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Contact:

Re: Label control focus

Post by karweru »

Thank you all,

Will try the suggestions.
Kind regards,
Gilbert.
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Label control focus

Post by srvet_claudio »

Hi,
see OnClick propr:

Label ... OnClick <ActionProcedureName>
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Label control focus

Post by serge_girard »

+10 Yes, Claudio , wellcome back!!
Serge
There's nothing you can do that can't be done...
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Label control focus

Post by srvet_claudio »

Thanks friends!!!
But I'm kind of rusty with Windows programming :lol: :lol: :lol:
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
Post Reply