another onkeypress question
Posted: Tue May 20, 2008 5:56 am
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 !
(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 !