HotKey for every controls
Moderator: Rathinagiri
HotKey for every controls
I'm building application for billing. I prefer keyboard.
So my idea is:
ability to define hotkey for every control
Now, we can realise that by ON KEY..., but it requests coding.
Best regards, Marek
(ps. It should be easy to do, I think.... , and, what do you, Roberto, think? )
So my idea is:
ability to define hotkey for every control
Now, we can realise that by ON KEY..., but it requests coding.
Best regards, Marek
(ps. It should be easy to do, I think.... , and, what do you, Roberto, think? )
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: HotKey for every controls
It's a nice idea, but no so much easy to makemol wrote:I'm building application for billing. I prefer keyboard.
So my idea is:
ability to define hotkey for every control
Now, we can realise that by ON KEY..., but it requests coding.
Best regards, Marek
(ps. It should be easy to do, I think.... , and, what do you, Roberto, think? )
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
Re: HotKey for every controls
This idea circulates in my head.
I'll realize in my app. declaring table for each window eg. { HotKey, cControlName}
then with _DefineHotKey I'll define hotkeys.
I'll realize in my app. declaring table for each window eg. { HotKey, cControlName}
then with _DefineHotKey I'll define hotkeys.
Re: HotKey for every controls
I've prepared a little sample with hotkeys
You can find Keycodes in hmg/include/i_keybd.ch
to do:
I don't know how to paste block to function without executing it..
Code: Select all
#include "hmg.ch"
/* Hotkeys for selected controls sample */
/* Marek Olszewski, MOL-SK 2010.04.16 */
Function Main
Local bBlock
DEFINE WINDOW Win_1 ;
AT 0,0 ;
WIDTH 400 ;
HEIGHT 400 ;
TITLE 'HotKey Demo' ;
MAIN
@ 10,50 label lt1 ;
value "Press Ctrl-1 to activate TextBox1" ;
width 200
@ 40,50 TEXTBOX Text_1 ;
VALUE 123 ;
WIDTH 120;
TOOLTIP 'Numeric TextBox' ;
NUMERIC ;
MAXLENGTH 5
@ 70,50 label lt2 ;
value "Press Ctrl-2 to activate TextBox2" ;
width 200
@ 100,50 TEXTBOX Text_2 ;
VALUE 123 ;
WIDTH 120;
TOOLTIP 'Numeric TextBox' ;
NUMERIC ;
MAXLENGTH 5
@ 130,50 label lt3 ;
value "Press Ctrl-3 to activate TextBox3" ;
width 200
@ 160,50 TEXTBOX Text_3 ;
VALUE 123 ;
WIDTH 120;
TOOLTIP 'Numeric TextBox' ;
NUMERIC ;
MAXLENGTH 5
END WINDOW
ahotkeys := {{VK_1, "Text_1"}, {VK_2, "Text_2"}, {VK_3, "Text_3"}}
for i := 1 to len(aHotKeys)
bBlock := '{|| DoMethod("WIN_1","'+aHotKeys[ i,2]+ '","SetFocus")}'
_DefineHotKey ( "WIN_1" , MOD_CONTROL , aHotKeys[i,1] , &bBlock)
next i
CENTER WINDOW Win_1
ACTIVATE WINDOW Win_1
Return
to do:
I don't know how to paste block to function without executing it..
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: HotKey for every controls
Hi Allmol wrote:... I prefer keyboard.
...
ability to define hotkey for every control
...
I fully share Marek's opinion.
I can't forget INKEY() yet
Regards, saludos
--
Esgici
Viva INTERNATIONAL HMG
Re: HotKey for every controls
Roberto Lopez wrote: It's a nice idea, but no so much easy to make
Going this way, I think it's very easy to make.
One extra field in IDE Object inspector (of course, it should be added to definition of every control), and while processing every control, added phrase
if !empty(HotKey)
_defineHotkey(....)
endif
It could be done without controlling syntactic correctness, with programmers responsibility.
(ps. Maybe for textboxes, datepicters for now?)
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: HotKey for every controls
I must think about it and test various solutions, but, my first idea is a 'OnKey' event for controls.mol wrote:Roberto Lopez wrote: It's a nice idea, but no so much easy to make
Going this way, I think it's very easy to make.
One extra field in IDE Object inspector (of course, it should be added to definition of every control), and while processing every control, added phrase
if !empty(HotKey)
_defineHotkey(....)
endif
It could be done without controlling syntactic correctness, with programmers responsibility.
(ps. Maybe for textboxes, datepicters for now?)
This event should receive the pressed keycode.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
Re: HotKey for every controls
It's also interesting and more universal
Great!
regards, Marek
Great!
regards, Marek
Re: HotKey for every controls
I thought about OnKey event and in my opinion, this won't be the same as Hotkey.
Onkey will be fired after key pressed - but control will be focused yet.
Hotkey should be quick implementation of ON KEY of WindowName.... phrase.
Marek
Onkey will be fired after key pressed - but control will be focused yet.
Hotkey should be quick implementation of ON KEY of WindowName.... phrase.
Marek
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: HotKey for every controls
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.