| View previous topic :: View next topic |
| Author |
Message |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Sat Aug 18, 2007 9:03 pm Post subject: Delphi Keystrokes - 1 blocks the other key >.< |
|
|
im trying to do like when im pressing left and down at the same time so ill get both events...
i got 4 events (left arrow, right, up and down) if i press 1 it works normaly but if i press 2 it only works for 1...
i already googled it and best thing i found was GetKeyState which will start/stop on key press...
couldnt figure out how to use onKeyDown or press or w/e...
any suggestions?
|
|
| Back to top |
|
 |
ups2000ups I post too much
Reputation: 0
Joined: 31 Jul 2006 Posts: 2471
|
Posted: Sat Aug 18, 2007 11:13 pm Post subject: |
|
|
hmm you mean when you press exampel left arrow then move object to left and the other arrows ?
but if you whant to go exampel up+right it wont work =/
if Odd(GetAsyncKeyState(VK_RIGHT+VK_Left)) then // if this dosent work do exampel 2
begin
object.left:=object.left+10;
object.top:=object.top+10;
end;end;
if Odd(GetAsyncKeyState(hotkey1.hotkey)) then //you can find a hotkey box and the write hotkey there
begin
object.left:=object.left+10;
object.top:=object.top+10;
end;end;
_________________
dont complain about my english...
1*1 = 2? |
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Sun Aug 19, 2007 12:14 am Post subject: |
|
|
i don't understand ur 2nd method O_o
1st doesnt work, u can complie but doesnt do anything instearsing...
|
|
| Back to top |
|
 |
ups2000ups I post too much
Reputation: 0
Joined: 31 Jul 2006 Posts: 2471
|
Posted: Sun Aug 19, 2007 1:00 am Post subject: |
|
|
well this 1 working for me but it is a little bugging you have to press the left+top at the same time or you will only go 1 line
| Quote: |
procedure TForm1.HotKeyCheckTimer(Sender: TObject);
begin
//left
if Odd(GetAsyncKeyState(VK_Left)) then
object1.left:=object1.left-10;
//right
if Odd(GetAsyncKeyState(VK_right)) then
object1.left:=object1.left+10;
//up
if Odd(GetAsyncKeyState(VK_up)) then
object1.top:=object1.top-10;
//Down
if Odd(GetAsyncKeyState(VK_Down)) then
object1.top:=object1.top+10;
//right + top
if Odd(GetAsyncKeyState(VK_RIGHT+VK_up)) then
begin
object1.top:=object1.top-10;
object1.left:=object1.left+10;
end;
//left + top
if Odd(GetAsyncKeyState(VK_left+VK_up)) then
begin
object1.top:=object1.top-10;
object1.left:=object1.left-10;
end;
//right + bottom
if Odd(GetAsyncKeyState(VK_RIGHT+VK_down)) then
begin
object1.top:=object1.top+10;
object1.left:=object1.left+10;
end;
//left + bottom
if Odd(GetAsyncKeyState(VK_left+VK_down)) then
begin
object1.top:=object1.top+10;
object1.left:=object1.left-10;
end;
end; |
_________________
dont complain about my english...
1*1 = 2? |
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Sun Aug 19, 2007 5:14 am Post subject: |
|
|
well still doesnt work....
doesnt matter now, i cant make my label incrase by 1 every keypress...
i tried
Label1.Caption := +1, IntToStr(+1) and Label1.Caption+IntToStr(1) or +1;
lets say its 10
so it changes to 1 or 101 i cant get it work... whats the problem?
|
|
| Back to top |
|
 |
nog_lorp Grandmaster Cheater
Reputation: 0
Joined: 26 Feb 2006 Posts: 743
|
Posted: Sun Aug 19, 2007 8:22 am Post subject: |
|
|
...
Label1.Caption := IntToStr(StrToInt(Label1.Caption)+1);
_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish |
|
| Back to top |
|
 |
ups2000ups I post too much
Reputation: 0
Joined: 31 Jul 2006 Posts: 2471
|
Posted: Sun Aug 19, 2007 11:32 am Post subject: |
|
|
| nog_lorp wrote: | ...
Label1.Caption := IntToStr(StrToInt(Label1.Caption)+1); |
or
var
LOL:integer;
begin
LOL:= label1.caption +1;
label1.Caption := IntToStr(LOL);
_________________
dont complain about my english...
1*1 = 2? |
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Sun Aug 19, 2007 12:23 pm Post subject: |
|
|
i thought about that O_o
i think i tried it and it didnt worked... dont remember ill try nog_lorps method
edit:
yea it works
i should have known i used inttostr on a label i needed the strtoint before =)
thanks
|
|
| Back to top |
|
 |
MadDoom Cheater
Reputation: 0
Joined: 27 Dec 2006 Posts: 38
|
Posted: Sun Aug 19, 2007 12:26 pm Post subject: |
|
|
| nog_lorp wrote: |
var
LOL:integer;
begin
LOL:= label1.caption +1;
label1.Caption := IntToStr(LOL); |
its will not work. you cant add a number to a string...
|
|
| Back to top |
|
 |
ups2000ups I post too much
Reputation: 0
Joined: 31 Jul 2006 Posts: 2471
|
Posted: Sun Aug 19, 2007 12:36 pm Post subject: |
|
|
| MadDoom wrote: | | nog_lorp wrote: |
var
LOL:integer;
begin
LOL:= label1.caption +1;
label1.Caption := IntToStr(LOL); |
its will not work. you cant add a number to a string... |
lol my foult xD
| Quote: |
var
LOL:integer;
begin
LOL:= label1.caption +1;
label1.Caption := strtoint(LOL); |
_________________
dont complain about my english...
1*1 = 2? |
|
| Back to top |
|
 |
|