PDA

View Full Version : reqkeyboard and keys value



.:Xk-Liber:.
09-13-2004, 05:41 AM
Hello. :o

Well, so now I want to get, easily, the value of a key from the keyboard in order to do a "dynamic search" from a word I type, each time I add a new letter.
Results will be listed in a listbox (and use of requpdate)

-> I type "a" => search for "a" in a tab
-> I type "b" => search for "ab" in a tab
-> I type "2" => search for "ab2" in a tab
...

reqkeyboard allows me to do it but it sucks.

I don't wanna get all the keys' value by :

switch(key){
case 'a':
da_key = "a";
break;
[...]
case 'z':
da_key = "z";
break;
}

etc. for ALL values (numbers, letters, exotic symbols ....) :eek:

Is there a method I haven't found like "key.StringValueOrSomethingLikeThat();" ??

Pleeeeasee heeelp I don't wanna lose my time like that ! :( :( :(

Thks in advance :o

NanoGator
01-11-2005, 10:51 PM
Doh. I was hoping there was an answer to this. Heh.

.:Xk-Liber:.
01-12-2005, 01:15 AM
Sorry NanoGator, but I haven't found a good solution to my pb. :(

evenflcw
01-12-2005, 08:51 PM
I might be misunderstanding, but if your typing a word are you not also creating a string? Then couldn't you just do a simple if-statement comparing the typed string with all the rest of the strings, limiting the rest using strleft() to keep everything the same wordlenght?

EDIT:
Hm... Started thinking... is there a way to check if you pressed a key, any key at all? Otherwise obviously LW wouldn't know to do a comparison after each new letter. I guess one could have a button to tell it to. That would be as fancy though

NanoGator
01-12-2005, 11:48 PM
If you use reqkeyboard it returns a number indicating the key that was pressed.

I think I worked it out, though. You can use the ascii command. If you type ascii("a"), you'll get 97. If you print what reqkeyboard returns, you also get '97'. With that, I can make it work. I do need to find the command, though, that'll turn 97 back into a lettter again. I imagine that's possible, only need to look into it a little more.

zuzzabuzz
01-16-2005, 12:09 PM
Weird that there is not a char() function of some sort.
Perhaps you could create a string "ABC...xyz",
and then build a lookup array where the index of each character in the string is the number returned by ascii();

so, lookup[97] would == 'a'. A bit of a memory waster, but might be necessary.

faulknermano
01-16-2005, 10:14 PM
I FOUND IT!!! HAHAHAHAHA! :D



a = 97;
info(a.asAsc());
return;



the nice warm feeling....... :D :D :D

thanks to nanogator for giving the clue... heehehehe

NanoGator
01-16-2005, 10:16 PM
I FOUND IT!!! HAHAHAHAHA! :D



a = 97;
info(a.asAsc());
return;



the nice warm feeling....... :D :D :D

thanks to nanogator for giving the clue... heehehehe


Ha!! Brilliant!

Oh man... now I can see how ya figured that out. *doh*

Cheers!

zuzzabuzz
01-16-2005, 11:03 PM
Ha!! Brilliant!

Oh man... now I can see how ya figured that out. *doh*

Cheers!

Not by looking in the lscript documentation, right? :rolleyes: (because I can't find it)

faulknermano
01-17-2005, 08:04 AM
Not by looking in the lscript documentation, right? :rolleyes: (because I can't find it)


it's in the release notes peoples.... :)


man, this link ought to be a sticky:

http://www.geocities.com/lightwavespreaddepot/LSCRIPT_DOCS.zip


this is my copy of the release notes.. i keep appending these as they come so they're all neat... :)


btw: i highly suggest finding the time to read through the release notes even though you may not find any particular use for it. there are so many features documented there but they're not categorised so it makes them harder to find. what i do is read through them, and somehow they stick, albeit vaguely. the next time there is a problem (like this one), i get a recollection that i saw that somewhere before.

NanoGator
01-19-2005, 11:49 AM
Beautiful!

.:Xk-Liber:.
02-19-2005, 06:12 AM
Ah ah .. :D thanks faulknermano for the answer :)