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....
Moderator: Rathinagiri
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? )
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
Hi Allmol wrote:... I prefer keyboard.
...
ability to define hotkey for every control
...
Roberto Lopez wrote: It's a nice idea, but no so much easy to make
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?)