In a former thread with the title "onkeypress question"
(http://fnxbasic.com/yabb/YaBB.pl?num=1210785692)
YaBB Administrator gave me an example, I added some lines:
`--------------------------------------------------
`begin of Code
object f as form
? ?object b as button
? ? ? ? ? ? ? ? ?onkeypress=kp
? ? ? ? ? ? ? ? ?OnClick=mytext
? ? end object
end object
f.showmodal
sub kp(key as integer)
? ?` If key=49 then mytext ? ? ` ?<--- please uncomment
? ? showmessage str$(key)
end sub
sub mytext()
showmessage "This is a Text"
end sub
` End of Code
`---------------------------------------------
Buts works fine, but if you uncomment the marked line ( "If key=49 then mytext" )
then you will get the following error message:
"error:22 line: 10 variable already used"
What is wrong here ? ?I don`t understand, why there is this error message !
another onkeypress question
another onkeypress question
Fazer!
The call of a subroutine require the parethesis:
If key=49 then mytext()
Note: but, in the object definition NOT! This is not error, it is a convention
PaPi
ps: Otherwise, although the fnxbasic help has some errors, but, this help is nessesary -
I am registering for me this errors for a long while... ... and the author work upon it and the new version of fnxbasic.
The call of a subroutine require the parethesis:
If key=49 then mytext()
Note: but, in the object definition NOT! This is not error, it is a convention
PaPi
ps: Otherwise, although the fnxbasic help has some errors, but, this help is nessesary -
I am registering for me this errors for a long while... ... and the author work upon it and the new version of fnxbasic.
another onkeypress question
Thanks!
This is an important advice!
This is an important advice!
another onkeypress question
Now the keydown-function works in my program, but there must be something wrong with the key code numbers.
( see "key table" in the help file).
The key code table is identical with the Delphi key codes if you change the hexadecimals to decimals, but it didn`t work completely correct in fnxbasic!
example: in the table of the help file there is the integer key value "78" for key "n", but it doesn`t work. But with my computer the "n"-key is in my program represented by the integer "110", the same is for the keys "p" = 111 and "p" = 112.
The number keys "0" ... "9" are correct: codes 48..57.
I have not checked all keys!
Had anybody a similar problem ?
( see "key table" in the help file).
The key code table is identical with the Delphi key codes if you change the hexadecimals to decimals, but it didn`t work completely correct in fnxbasic!
example: in the table of the help file there is the integer key value "78" for key "n", but it doesn`t work. But with my computer the "n"-key is in my program represented by the integer "110", the same is for the keys "p" = 111 and "p" = 112.
The number keys "0" ... "9" are correct: codes 48..57.
I have not checked all keys!
Had anybody a similar problem ?
another onkeypress question
hi
I think you must use the asci keycode,
n=110 but
N=78
for windows asci keys n and N are both 78.
if you want to detect both on the same time you can do
key=asc(ucase$(chr$(key)))
best regards
I think you must use the asci keycode,
n=110 but
N=78
for windows asci keys n and N are both 78.
if you want to detect both on the same time you can do
key=asc(ucase$(chr$(key)))
best regards
another onkeypress question
Some things are so easy - if you know them !
Thank you so much!
Thank you so much!