FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Keys.CONTROL ~ Keys.N compile error

 
Post new topic   Reply to topic     Forum Index -> DFL
View previous topic :: View next topic  
Author Message
jicman



Joined: 22 Dec 2004
Posts: 298
Location: Rochester, NY

PostPosted: Wed Jan 10, 2007 8:55 am    Post subject: Keys.CONTROL ~ Keys.N compile error Reply with quote

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
View user's profile Send private message
Chris Miller



Joined: 27 Mar 2004
Posts: 514
Location: The Internet

PostPosted: Wed Jan 10, 2007 11:26 am    Post subject: Re: Keys.CONTROL ~ Keys.N compile error Reply with quote

Code:
if(ea.keyCode == (Keys.CONTROL | Keys.N))
    {
       msgBox("CTRL+N Keys pushed...");
    }
Back to top
View user's profile Send private message
jicman



Joined: 22 Dec 2004
Posts: 298
Location: Rochester, NY

PostPosted: Thu May 17, 2007 11:20 am    Post subject: Re: Keys.CONTROL ~ Keys.N compile error Reply with quote

[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
View user's profile Send private message
Chris Miller



Joined: 27 Mar 2004
Posts: 514
Location: The Internet

PostPosted: Thu May 17, 2007 8:28 pm    Post subject: Reply with quote

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
View user's profile Send private message
jicman



Joined: 22 Dec 2004
Posts: 298
Location: Rochester, NY

PostPosted: Fri May 25, 2007 11:11 pm    Post subject: Reply with quote

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
View user's profile Send private message
Chris Miller



Joined: 27 Mar 2004
Posts: 514
Location: The Internet

PostPosted: Wed May 30, 2007 5:17 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DFL All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group