Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Tue Dec 18, 2018 12:40 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Problem with the keys...
PostPosted: Sat Mar 30, 2013 7:33 am 
Offline

Joined: Sun Oct 21, 2012 10:47 am
Posts: 76
Location: Slovenia
Well i get and error saying that "key" does not exist, when i try to do this:
if key = "a"  then
MsgBox("pressed a...")
end


All i wana do, is check when "enter" key has been entered, i have searched using the search, and tried the examples by copying their codes and all, and language reference, but i don't know...


Top
 Profile  
Reply with quote  
 Post subject: Re: Problem with the keys...
PostPosted: Sat Mar 30, 2013 8:58 am 
Offline
User avatar

Joined: Fri Jun 05, 2009 11:50 am
Posts: 348
Location: Hamburg, Germany
have a look at this post

and language reference

_________________
Best regards

Stefan

Mac OSX Mountain Lion (latest Release) on a MacBook Pro 2.66 GHz Intel Core i7/ RB Professional 2011 Release 3


Top
 Profile  
Reply with quote  
 Post subject: Re: Problem with the keys...
PostPosted: Sat Mar 30, 2013 12:22 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
Is your code in a KeyDown event?


Top
 Profile  
Reply with quote  
 Post subject: Re: Problem with the keys...
PostPosted: Sun Mar 31, 2013 4:47 am 
Offline

Joined: Sun Oct 21, 2012 10:47 am
Posts: 76
Location: Slovenia
It was in KeyUp - which i shouldn't use, but how would code look for KeyUp then...

Also what Ascii table version did you guys look at to get enter as 3 ? I checked a few and nothing similar <.<...


Top
 Profile  
Reply with quote  
 Post subject: Re: Problem with the keys...
PostPosted: Sun Mar 31, 2013 5:21 am 
Offline
User avatar

Joined: Fri Jun 05, 2009 11:50 am
Posts: 348
Location: Hamburg, Germany
Asc returns the integer code point for the first character in the passed String in the characters encoding. Characters 0 through 127 are the standard ASCII set, which are the same on practically every encoding.

Enter = End of Text = DEC 3
Return = Carriage Return = DEC 13

If you need to get the ASCII code of the first byte of the string rather than the first character, use the AscB function.



to get the codepoint value use
msgbox "User hit " + key + which equals chr(" + str(asc(Key)) + "

in key down event

Keyup is raised in case keydown returns false.

Everthing can be found in the Language Reference

_________________
Best regards

Stefan

Mac OSX Mountain Lion (latest Release) on a MacBook Pro 2.66 GHz Intel Core i7/ RB Professional 2011 Release 3


Top
 Profile  
Reply with quote  
 Post subject: Re: Problem with the keys...
PostPosted: Sun Mar 31, 2013 6:08 am 
Offline

Joined: Sun Oct 21, 2012 10:47 am
Posts: 76
Location: Slovenia
I been doing everything in non GUI programing languages, thus this is all awkward to me, even though i know why all is made this way, and i practice GUI in C# and school, and i hate C# <.< and it's Visual Studio, prefer Real Studio million times over :D.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


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

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group