New topic: Strange Keyboard Codes
<http://forums.realsoftware.com/viewtopic.php?t=28135> Page 1 of 1 [ 4 posts ] Previous topic | Next topic AuthorMessageDaveS Post subject: Strange Keyboard CodesPosted: Tue May 19, 2009 9:40 pm Joined: Sun Aug 05, 2007 10:46 am Posts: 1115 Location: San Diego, CA First to qualify.... this was done with a US-English Keyboard Code in KEYDOWN Event Code: ASCII=AscB(key) keyModifier=0 If Keyboard.Altkey Then keyModifier=KEYMODIFIER+1 'OSX=Option If Keyboard.controlkey Then keyModifier=KEYMODIFIER+2 ' CTRL+ If Keyboard.MenuShortCutKey Then keyModifier=KEYMODIFIER+4 ' Apple Command winmain.title=str(keyModifier)+"/"+str(ASCII) If I type A thru Z or Shift A-Z I get the values I expect 0 for keyModifier and 65-90 or 97 to 122... no problem If I hold down the Control key then I get 2 for keyModifier and 01 to 26 for ASCII.... perfect If I hold down the Command Key then I get 4 for keyModifier and 97 to 122 for ASCII.... also just right For Control and CMD I get 6 for KeyMod and 01 to 26 for ASCII... bingo For Alt-Ctrl I get 3 for KeyMod and 01 to 26 for ASCII... as expected Even Alt-Ctrl-CMD gives the right result of 7 for Keymod and 01 to 26 for ASCII HOWEVER..... [I know took me long enough to get the point eh?] If I hold down the ALT key and press A thru Z I DO NOT get what I expect I would expect KeyMod to alway be 1, and ASCII to be some sequence of 26 consecutive numbers just like all the other combinations above... What I get is this.... notice that for E, I, N and U the Keymodifer isn't even set, and there seems to be no rhyme or reason to the rest of the code numbers? Oh... and throw the SHIFT key in, and its a whole different sequence of numbers a=1/229 b=1/043 c=1/231 d=1/002 e=0/180 f=1/146 g=1/169 h=1/217 i=0/198 j=1/006 k=1/218 l=1/172 m=1/181 n=0/220 o=1/248 p=1/192 q=1/083 r=1/174 s=1/223 t=1/032 u=0/168 v=1/026 w=1/017 x=1/072 y=1/165 z=1/169 Can anyone enlighten me here. I need to know what key combination was pressed.... I tried looping thru the keycodes etc... but that was WAY WAY to slow [this is a text editor, and I can outtype the loop] _________________ Dave Sisemore MacPro, RB2008r3.1 Top HiddenPaw Post subject: Re: Strange Keyboard CodesPosted: Tue May 19, 2009 10:37 pm Joined: Sat Oct 01, 2005 12:01 pm Posts: 52 Location: San Jose Quote:notice that for E, I, N and U the Keymodifer isn't even set also the -->`<-- key just below the <esc> key returns 0/96 if you bring up keyboard viewer and press the alt/option key these are the only five keys to turn orange it is a clue, however i know not what it means Top npalardy Post subject: Re: Strange Keyboard CodesPosted: Wed May 20, 2009 12:02 am Joined: Sat Dec 24, 2005 8:18 pm Posts: 4879 Location: Canada, Alberta, Near Red Deer alt-E then E gives é alt-U then E gives ë alt-I then E gives ê alt-N then N gives ñ (there's no composition with a E hence the changed example) alt-` then E gives è it's how you compose some of the special characters with umlauts etc _________________ My web site Great White Software RBLibrary.com REALbasic learning Top DaveS Post subject: Re: Strange Keyboard CodesPosted: Wed May 20, 2009 12:35 am Joined: Sun Aug 05, 2007 10:46 am Posts: 1115 Location: San Diego, CA Ok... I'll by that..... might even come in handy for my app.... but what about the rest? Do I have to build a xref table to determine the correct key if ALT<char> is pressed??? _________________ Dave Sisemore MacPro, RB2008r3.1 Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 4 posts ]
-- Over 900 classes with 18000 functions in one REALbasic plug-in. The Monkeybread Software Realbasic Plugin v8.1. <http://www.monkeybreadsoftware.de/realbasic/plugins.shtml> [email protected]
