Hi!
I want to define hotkey eg. F6 which will realize different functions upon the control which has focus currently.
Is it possible to determine, which control has focus now?
I can't find such a information...
Marek
Current control name - how to get this information?
Moderator: Rathinagiri
Re: Current control name - how to get this information?
Hi Marek,mol wrote:Hi!
I want to define hotkey eg. F6 which will realize different functions upon the control which has focus currently.
Is it possible to determine, which control has focus now?
I can't find such a information...
Please try the following simple sample from the HMG distribution:
Code: Select all
/*
* HMG - Harbour Win32 GUI library Demo
*
* Copyright 2002 Roberto Lopez <mail.box.hmg@gmail.com>
* http://sites.google.com/site/hmgweb/
*/
#include "hmg.ch"
Function Main
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 640 HEIGHT 480 ;
TITLE 'HMG Demo' ;
MAIN
ON KEY F2 ACTION MsgInfo ( ThisWindow.FocusedControl )
@ 10,10 TEXTBOX Text_1
@ 50,10 TEXTBOX Text_2
@ 90,10 TEXTBOX Text_3
END WINDOW
Form_1.Center
Form_1.Activate
Return Nil
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Current control name - how to get this information?
Hi Marek,
Why don't you use 'this'?
From HMG Reference:
Why don't you use 'this'?
From HMG Reference:
Code: Select all
This.<Property/MethodName>
It provides a reference to the current control/window in event code.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: Current control name - how to get this information?
It really works!!!gfilatov wrote:Hi Marek,mol wrote:Hi!
I want to define hotkey eg. F6 which will realize different functions upon the control which has focus currently.
Is it possible to determine, which control has focus now?
I can't find such a information...
Please try the following simple sample from the HMG distribution:Hope that usefulCode: Select all
/* * HMG - Harbour Win32 GUI library Demo * * Copyright 2002 Roberto Lopez <mail.box.hmg@gmail.com> * http://sites.google.com/site/hmgweb/ */ #include "hmg.ch" Function Main DEFINE WINDOW Form_1 ; AT 0,0 ; WIDTH 640 HEIGHT 480 ; TITLE 'HMG Demo' ; MAIN ON KEY F2 ACTION MsgInfo ( ThisWindow.FocusedControl ) @ 10,10 TEXTBOX Text_1 @ 50,10 TEXTBOX Text_2 @ 90,10 TEXTBOX Text_3 END WINDOW Form_1.Center Form_1.Activate Return Nil
Thanks for your quick responce.
You are BIG, Grigori
I've tried this way, but it doesn't want to work and generate runtime error:rathinagiri wrote:Hi Marek,
Why don't you use 'this'?
From HMG Reference:
Code: Select all
This.<Property/MethodName> It provides a reference to the current control/window in event code.
Code: Select all
Control: Of OknoSystem Not defined. Program Terminated
Best regards, Marek
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Current control name - how to get this information?
Yes. Perhaps it doesn't work on 'On Key'.
Thanks a lot Grigory.
Thanks a lot Grigory.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.