View previous topic :: View next topic |
Author |
Message |
jicman
Joined: 22 Dec 2004 Posts: 298 Location: Rochester, NY
|
Posted: Wed Jan 10, 2007 8:55 am Post subject: Keys.CONTROL ~ Keys.N compile error |
|
|
Greetings!
I am trying to do,
Code: | if(ea.keyCode == Keys.CONTROL ~ Keys.N)
{
msgBox("CTRL+N Keys pushed...");
}
|
but I am getting this error from the compiler, Quote: | OpenJobs.d(577): Error: Can only concatenate arrays, not (Keys ~ Keys) |
I know how to work around this, but what is your suggestion for the easiest way to do a multiple Keys check?
thanks,
josé |
|
Back to top |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Wed Jan 10, 2007 11:26 am Post subject: Re: Keys.CONTROL ~ Keys.N compile error |
|
|
Code: | if(ea.keyCode == (Keys.CONTROL | Keys.N))
{
msgBox("CTRL+N Keys pushed...");
}
|
|
|
Back to top |
|
|
jicman
Joined: 22 Dec 2004 Posts: 298 Location: Rochester, NY
|
Posted: Thu May 17, 2007 11:20 am Post subject: Re: Keys.CONTROL ~ Keys.N compile error |
|
|
[quote="Chris Miller"] Code: | if(ea.keyCode == (Keys.CONTROL | Keys.N))
{
msgBox("CTRL+N Keys pushed...");
}
|
Chris,
this code above is not working. Here is a function that I have which is not working on multiple pushed keys:
Code: | private void lview_keyDown(Object sender, KeyEventArgs ea)
{
if(ea.keyCode == Keys.ENTER)
{
lview_doubleClick(sender, ea);
}
else if(ea.keyCode == (Keys.CONTROL | Keys.N))
{
msgBox("CTRL+N Keys pushed...");
}
else if(ea.keyCode == Keys.ESCAPE )
{
btnOpenProjs_click(sender, ea);
}
else if(ea.keyCode == Keys.E)
{
btnEdit_click(sender, ea);
}
}
|
the single pushed keys work, but the multiple simultaneous pushed keys do not work. Any ideas?
thanks,
jose |
|
Back to top |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Thu May 17, 2007 8:28 pm Post subject: |
|
|
Oh, I only corrected the main issue. The reason why it's not working is keyCode is only the key without any modifiers; there's keyData that includes the key and modifiers, and there's also modifiers that's just the modifiers. |
|
Back to top |
|
|
jicman
Joined: 22 Dec 2004 Posts: 298 Location: Rochester, NY
|
Posted: Fri May 25, 2007 11:11 pm Post subject: |
|
|
I have been looking into this keyCode phonomenum and I am trying to figure out how to get the key pushed on this event. I would like to assign that key and use it, but I don-t want to a case and check through all the Keys.A ... Keys.Z, etc. I would just like to get that string. For example, if I entered an "a", I would like to use that "a" and assign it to a variable. I know I can use keyCode to get the ASCII or UTF value of the key pushed, but is there a way to get the char pushed?
thanks,
jose |
|
Back to top |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Wed May 30, 2007 5:17 am Post subject: |
|
|
jicman wrote: | I would just like to get that string. For example, if I entered an "a", I would like to use that "a" and assign it to a variable. I know I can use keyCode to get the ASCII or UTF value of the key pushed, but is there a way to get the char pushed? |
There's Windows API functions ToUnicode (WinNT+) and ToAscii (Win9x); you will probably need to add extern(Windows) prototypes to access them.
I'm not sure yet where this could fit into DFL. |
|
Back to top |
|
|
|