Where is the "ON KEY" or _DefineHotKey() info stored ?

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

Where is the "ON KEY" or _DefineHotKey() info stored ?

Post by trmpluym »

Ik like to save and restore all the current "ON KEY" information to a variable (Array?)

I figured out the command

#xcommand ON KEY ADD [ OF <parent> ] ACTION <action> ;

is translated into:

_DefineHotKey ( <"parent"> , 0 , VK_ADD , <{action}> )

But where is this info stored ? In the source it seems _HMG_SYSDATA [1] ?

Is it enough to save _HMG_SYSDATA [1] to a temporary array and later overwrite it back, for example ?

aOldKeys := _HMG_SYSDATA [1]

and afterwards

_HMG_SYSDATA [1] := aOldkeys
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Where is the "ON KEY" or _DefineHotKey() info stored ?

Post by Pablo César »

Hello Theo,

I do not know if you have already solved your case but I prepared this routine maybe helps to clarify and be also useful to others for releasing of all HotKey from a form:
 
HotKey.rar
Source files demo
(1.62 KiB) Downloaded 250 times
 
It would be also nice to count in HMG a GLOBAL hotkey definition, like HMEE.
All forms are considered at Events procedure. Easy and effective. Have you seen that ?
http://hmgextended.com/files/manual/4135.htm

In any case the example is also serves to them too, just inform the name of the form. :)
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

Re: Where is the "ON KEY" or _DefineHotKey() info stored ?

Post by trmpluym »

Hi Pablo,

Thanks for answering !

I studied your code but i do not (yet) understand the the way the hotkeys are stored.

Can you explain me the what the following system array's contain ?

_HMG_SYSDATA [3]
_HMG_SYSDATA [1]
_HMG_SYSDATA[4]
_HMG_SYSDATA[7]
_HMG_SYSDATA[8]

Theo
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Re: Where is the "ON KEY" or _DefineHotKey() info stored ?

Post by Pablo César »

Hi Theo,

I will try to explain a bit and I hope you can understand. It's not because I know everything, far of this.

What is really nice when user do not desists and try by theirselves digging the HMG source codes and then could be learn a lot. If chare, all we win with that. :)

Do you know this function MsgDebug ?
Please, do not make hurry up in my question.
I will answer, in place: I use a lot more than debugger, very pratical and fast.

When you make me this question:
trmpluym wrote: Mon Mar 27, 2017 9:00 pm Can you explain me the what the following system array's contain ?

_HMG_SYSDATA [3]
_HMG_SYSDATA [1]
_HMG_SYSDATA[4]
_HMG_SYSDATA[7]
_HMG_SYSDATA[8]
  1. IMHO, the maining it's very wide and comprehensive these vectors you mentioned and I'll show you with this example:
    http://hmgforum.com/viewtopic.php?p=50376#p50376
     
  2. And now with this other (just remove the characters as comments (here's green color):
    Screen150.png
    Screen150.png (31.88 KiB) Viewed 2715 times
 
Different results, doesn't it ?

Ok. Lets go to yours questions.
I am to blame from begining, because I should have just limited myself to answering your question.
I wanted to be more extensive and with that answer in this topic in another one that has there.
trmpluym wrote: Mon May 30, 2016 5:16 pm Ik like to save and restore all the current "ON KEY" information to a variable (Array?)
This is possible. You will see at \hmg.3.4.3\INCLUDE\i_keybd.ch file (where is being all HMG keys controls). There you also will see there is a COMMAND: STORE KEY <HMG_key> OF <parent> TO <baction> which it will assign to a variable (but this is not a normal variable, it's a CodeBlock type). i.e. Its has an ACTION and can not be displayed o simple readable like a character type.
 
trmpluym wrote: Mon May 30, 2016 5:16 pm I figured out the command

#xcommand ON KEY ADD [ OF <parent> ] ACTION <action> ;

is translated into:

_DefineHotKey ( <"parent"> , 0 , VK_ADD , <{action}> )
That's you right. Please note the define function has 4 arguments. Keep it for forward explanation.
 
trmpluym wrote: Mon May 30, 2016 5:16 pm But where is this info stored ? In the source it seems _HMG_SYSDATA [1] ?

Is it enough to save _HMG_SYSDATA [1] to a temporary array and later overwrite it back, for example ?
Yes, you are quite right. You will need the ACTION and three more arguments necessary to be stored. As you said in ARRAY, but not tempory. Must be PRIVATE, I guess. The action for HOTKEY control at HMG is saved/stored at _HMG_SYSDATA[ 6 ][ Index_Control ].

I prepared another Demo for you. Now you need to see how I've done:
 
HotKeys_Demo2.rar
Source files - Demo2
(1.88 KiB) Downloaded 199 times
 
I hope I let you clear now. Sorry if my English it's not so good and also sorry if It seems (sure is not) that I have to underestimate on your knowledges.
When we can not express ourselves well, it leaves a sea of doubts. Maybe I have been repetitive or very extensive in my explanation, sorry for that.
But hopefully it was worth it for you to understand more about HotKeys.

Kevin Carmody, has prepared a large HotKey definition and according to Claudio is being release at next HMG version. :)
Attachments
Var_Stru.rar
Source and executable files
(1.26 MiB) Downloaded 200 times
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply