[Gambas-user] DO LOOP loop interrupt with Key press?

na2492 at ...9... na2492 at ...9...
Thu Aug 5 20:36:21 CEST 2004


>Hi Fabien,
>
>I had try it but I get the same error.
>I insert the TextBox1.SetFocus() above the DO and an empty
>TextBox1_KeyPress() and get directly the "No Keyboard Event Data".
>
>Regards
>Christoph
>
>Am Mi, den 04.08.2004 schrieb Bodard Fabien um 20:59:
>> Le mercredi 4 Août 2004 18:05, vous avez écrit :
>> > Hi Bodard Fabien,
>> >
>> > thank you for your answer, I have try it with the follow sample code,
>> >
>> > PUBLIC SUB Button5_Click()
>> > DIM i AS Integer
>> textbox1.setfocus
>> > DO
>> > TextBox1.Text=i
>> > TextBox1.Text= i + TextBox1.Text
>> > TextBox1.Refresh()
>> > INC i
>> > WAIT 0.2
>> > IF Key.Code=Key.Escape THEN BREAK
>> >
>> > LOOP
>> >
>> > but I get the error "No Keyboard event Data" when I start the Progr.
>> > any idea??
>> >
>> > Thanks in Advance
>> > Christoph
>> >
>> >
>>
>> You need to add an empty event
>>
>> PUBLIC SUB TextBox1_KeyPress()
>> END
>>
>>
>>
>> Regards,
>> Fabien Bodard
>>

Salut,

set on the top of the Class  somethink like :
Dim bStop as Boolean  ' is FALSE at this time

then

PUBLIC SUB TextBox1_KeyPress()
     IF Key.Code=Key.Escape THEN bStop = True
END

before your Do ... Loop
bStop = False


and in your Do ... Loop

IF bStop THEN BREAK


Amicalement
Charlie
* Gesendet mit / Sent by: FEN-Webmail * http://www.fen-net.de *




More information about the User mailing list