Activating controls by ALT+... hotkey

Moderator: Rathinagiri

User avatar
dhaine_adp
Posts: 457
Joined: Wed Aug 06, 2008 12:22 pm
Location: Manila, Philippines

Re: Activating controls by ALT+... hotkey

Post by dhaine_adp »

From your code:

@ 15,10 LABEL l1 ;
VALUE "Press ALT-&T to activate textbox" ;
width 200 ACTION LblAction() ONCLICK LblAction()


static function LblAction()

FORM_1.TEXT_1.SETFOCUS
return nil
Hi Marek,

I'm sorry I was wrong with my assumption on my last post. The code generates syntax error during compilation. In the alternate syntax its either ACTION or ONCLICK event is possible to be tied up with the accelerator key or shortcut. The code I quoted above simply won't work. Right now I'm out of suggestion to fix your problem. :(

In my testing, the mouse click and ALT+T works fine with Win XP SP2.

I'm sorry again friend, I hope that your not so disappointed...

- Danny
Regards,

Danny
Manila, Philippines
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Activating controls by ALT+... hotkey

Post by mol »

I've tested my simple sample and it works OK in win'7.
But my complex application causes problems.
I'm working on this.
I'll post when I find any solution...
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Activating controls by ALT+... hotkey

Post by mol »

I think, I've resolved problem.
It lays in IDE.
I've prepared sample with IDE - simple window with three controls.
It seems that windows prepared with IDE and loaded from .FMG files are threated in different way from windows defined programmatically.
I'm attaching sample.

Please, try to compile it
Best regards, Marek
Attachments
hotkeytest.zip
(1.46 KiB) Downloaded 268 times
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Activating controls by ALT+... hotkey

Post by mol »

I've added one sample button to this form and pressing ALT-Q, ALT-W, ALT-E calls button, not action from labels!
Attachments
hotkeytest.zip
(1.56 KiB) Downloaded 280 times
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Activating controls by ALT+... hotkey

Post by mol »

I wanna refresh this post to take Roberto attention :-)

Best regards, Marek
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Activating controls by ALT+... hotkey

Post by Roberto Lopez »

mol wrote:I wanna refresh this post to take Roberto attention :-)

Best regards, Marek
You already have my attention :)

I've been busy. I'll check your code soon.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Activating controls by ALT+... hotkey

Post by Roberto Lopez »

mol wrote:I've started to work with my new app. I prefer keyboard to work with computers, so I've defined hotkey for almost controls in my program.
And found, that sometimes, after pressing hotkey defined with alt key, alt activates menu too.
This is very troublesome, because thirst character of entered date is missing.

I've prepared a little sample. Try to compile it and then, try to use ALT-T key to activate textbox and enter some numbers.
Try to do it few times, because this is a lottery - sometimes works good, sometimes bad.
I've especially defined main menu to watch when it's activated.
Ok.

I'm answering this (the first post in the thread).

I've tested and IMHO it is working as expected.

I'll explain:

The menu activation with the <alt> key is automatically handled by the operating system. This is not a bug. This is an operating system feature.

Moreover, if you press the alt key only and then (without releasing it) press t key, it works well (not randomly).

IMHO, the apparently 'random' behavior comes (probably) by the way in the alt+t combination is pressed, but (as I've said) if you keep your finger in the alt key without releasing it, all goes fine.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Activating controls by ALT+... hotkey

Post by Roberto Lopez »

mol wrote:I've tested Danny's idea on Windows XP and worked OK.
But, now, I'm trying it on Windows 7 and it works only when I click with mouse on label, but does not work with keyboard hotkey.
Maybe Roberto will know what's going on?
Why labels are not activated by hotkey in Win'7?
There is no special code in HMG to support this. This is not documented or officially supported.

In fact I've never tested or tried this.

This is handled by the operating system automatically.

Usually there is some little incompatibilities between Windows versions, some of that are documented in MSDN and (hopefully) a workaround is published.

Grigory: Have you any additional info about that?
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Activating controls by ALT+... hotkey

Post by Roberto Lopez »

mol wrote:I've added one sample button to this form and pressing ALT-Q, ALT-W, ALT-E calls button, not action from labels!
Look at the above message.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Activating controls by ALT+... hotkey

Post by Roberto Lopez »

mol wrote:I think, I've resolved problem.
It lays in IDE.
I've prepared sample with IDE - simple window with three controls.
It seems that windows prepared with IDE and loaded from .FMG files are threated in different way from windows defined programmatically.
I'm attaching sample.

Please, try to compile it
Best regards, Marek
The LOAD WINDOW <window.fmg> command is translated to a #include <window.fmg>, so it should must perform the same.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
Post Reply