Label control focus

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
karweru
Posts: 193
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Been thanked: 9 times
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: 2481
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 773 times
Been thanked: 146 times
Contact:

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

User avatar
mol
Posts: 3332
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 251 times
Been thanked: 152 times
Contact:

Post by mol »

I think labels have no focus.

User avatar
AUGE_OHR
Posts: 794
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany
Has thanked: 111 times
Been thanked: 199 times

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: 794
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany
Has thanked: 111 times
Been thanked: 199 times

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: 193
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Been thanked: 9 times
Contact:

Post by karweru »

Thank you all,

Will try the suggestions.
Kind regards,
Gilbert.

Post Reply