Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 779 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Trapping extended key? #224282
08/29/08 13:18
08/29/08 13:18
Joined: May 2008
Posts: 91
Eugene, OR. USA
ATOMIX Offline OP
Junior Member
ATOMIX  Offline OP
Junior Member

Joined: May 2008
Posts: 91
Eugene, OR. USA
I use the following command to lock a keystroke to a function
Code:
on_2 = freeCamera;

How do I trap an extended keystroke combination like ctrl-a or alt-c? I know how to check for it but can't see how to use it like above.
Any help is greatly appreciated.


ATOMIX Productions
ATOMIX Group LLC
http://theatomizer.com
A7 Pro 7.50
Re: Trapping extended key? [Re: ATOMIX] #224314
08/29/08 15:21
08/29/08 15:21
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
function that_shall_be_run_when_alt_and_c_is_pressed ()
{
...
}

function that_shall_be_run_when_only_c_is_pressed ()
{
...
}
function that_shall_be_run_when_c_is_pressed ()
{
if (key_alt) that_shall_be_run_when_alt_and_c_is_pressed ();
else function that_shall_be_run_when_only_c_is_pressed ();
}

...

on_c = that_shall_be_run_when_c_is_pressed;

wink

Re: Trapping extended key? [Re: Lukas] #224504
08/30/08 15:11
08/30/08 15:11
Joined: May 2008
Posts: 91
Eugene, OR. USA
ATOMIX Offline OP
Junior Member
ATOMIX  Offline OP
Junior Member

Joined: May 2008
Posts: 91
Eugene, OR. USA
Lukas: Thanks for responding! I was confused about how on_alt and on_ctrl works. I would have done it like.
Initialize it.
Code:
on_alt = altKeyFunction;


Then the function.
Code:
function altKeyFunction()
{
   if (key_c)
      ...
   if (key_h)
      ...
}

But this is different than your approach. Will it work?


ATOMIX Productions
ATOMIX Group LLC
http://theatomizer.com
A7 Pro 7.50
Re: Trapping extended key? [Re: ATOMIX] #224508
08/30/08 15:49
08/30/08 15:49
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
Hmm, yes, but on_c will also be executed when prssing alt+c. Also, usually you have to hold alt first and then press c for executing the function, yours also allowes first pressing c and then pressing alt.

Re: Trapping extended key? [Re: Lukas] #225643
09/05/08 14:37
09/05/08 14:37
Joined: May 2008
Posts: 91
Eugene, OR. USA
ATOMIX Offline OP
Junior Member
ATOMIX  Offline OP
Junior Member

Joined: May 2008
Posts: 91
Eugene, OR. USA
Thanks for the input! It's Amazing how a little change can really change everything.


ATOMIX Productions
ATOMIX Group LLC
http://theatomizer.com
A7 Pro 7.50

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1