VBAndCs / sVB-Small-Visual-Basic

Small Visual Basic (sVB) is an educational programming language, created by Eng. Mohammad Hamdy as an evolved version of Microsoft Small Basic (SB). It is meant to be easier and more powerful at the same time, to introduce programming basics to kids and beginners of any age, provided that they can use the English keyboard on the Windows OS.
Other
233 stars 16 forks source link

After clicking the button on the form, the form is unable to respond to the OnKeyDown event. #62

Closed dynamicboy closed 6 months ago

dynamicboy commented 6 months ago

After clicking the button on the form, the form is unable to respond to the OnKeyDown event.

I'm using Small Visual Basic 3.0 to create a typing application.

I placed some controls, such as radio buttons and regular buttons, to switch the application status.

I found that after interacting with these controls, the form is no longer able to respond to the OnKeyDown event.

I believe this is a bug.

VBAndCs commented 6 months ago

OnKeyDown of which control? The control should has focus to be able to handle the OnKeyDown event. If you are handling the Form.OnKeydown, clicking the button will focus it, so, it will receive the keyboard events, not the form. This is why there is another event called OnPreviewKeyDown, which allows the form to respond to the event before any other child control. Try it and tell me what happed.


From: dynamicboy @.> Sent: Thursday, May 2, 2024 9:37 PM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Subscribed @.***> Subject: [VBAndCs/sVB-Small-Visual-Basic] After clicking the button on the form, the form is unable to respond to the OnKeyDown event. (Issue #62)

After clicking the button on the form, the form is unable to respond to the OnKeyDown event.

I'm using Small Visual Basic 3.0 to create a typing application.

I placed some controls, such as radio buttons and regular buttons, to switch the application status.

I found that after interacting with these controls, the form is no longer able to respond to the OnKeyDown event.

I believe this is a bug.

— Reply to this email directly, view it on GitHubhttps://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/62, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVU3ZU5TXAH4LPP5F3LZAKW3FAVCNFSM6AAAAABHEPK4USVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI3TMNJUGU4DQOI. You are receiving this because you are subscribed to this thread.Message ID: @.***>

dynamicboy commented 6 months ago

OnKeyDown of which control? The control should has focus to be able to handle the OnKeyDown event. If you are handling the Form.OnKeydown, clicking the button will focus it, so, it will receive the keyboard events, not the form. This is why there is another event called OnPreviewKeyDown, which allows the form to respond to the event before any other child control. Try it and tell me what happed. ____ From: dynamicboy @.> Sent: Thursday, May 2, 2024 9:37 PM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Subscribed @.> Subject: [VBAndCs/sVB-Small-Visual-Basic] After clicking the button on the form, the form is unable to respond to the OnKeyDown event. (Issue #62) After clicking the button on the form, the form is unable to respond to the OnKeyDown event. I'm using Small Visual Basic 3.0 to create a typing application. I placed some controls, such as radio buttons and regular buttons, to switch the application status. I found that after interacting with these controls, the form is no longer able to respond to the OnKeyDown event. I believe this is a bug. — Reply to this email directly, view it on GitHub<#62>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVU3ZU5TXAH4LPP5F3LZAKW3FAVCNFSM6AAAAABHEPK4USVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI3TMNJUGU4DQOI. You are receiving this because you are subscribed to this thread.Message ID: @.>

You are right, in OnPreviewKeyDown event, the form can always receive the keyboard key event. I remember I asked a question about event related issue before, that was about four months ago, a little bit forgetful, that is about the event propagation path issue. I have noted that. I have started to program using Small Visual Basic recently again, and I am very glad to see the 3.0 version is released, it is much easier to use than before. I will promote Small Visual Basic vigorously in China. Thank you. (Translated by AI)

VBAndCs commented 6 months ago

I am glad I could help. Have fun with sVB. Thanks.


From: dynamicboy @.> Sent: Friday, May 3, 2024 4:08 AM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Mohammad Hamdy Ghanem @.>; Comment @.> Subject: Re: [VBAndCs/sVB-Small-Visual-Basic] After clicking the button on the form, the form is unable to respond to the OnKeyDown event. (Issue #62)

OnKeyDown of which control? The control should has focus to be able to handle the OnKeyDown event. If you are handling the Form.OnKeydown, clicking the button will focus it, so, it will receive the keyboard events, not the form. This is why there is another event called OnPreviewKeyDown, which allows the form to respond to the event before any other child control. Try it and tell me what happed. … ____ From: dynamicboy @.> Sent: Thursday, May 2, 2024 9:37 PM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Subscribed @.> Subject: [VBAndCs/sVB-Small-Visual-Basic] After clicking the button on the form, the form is unable to respond to the OnKeyDown event. (Issue #62https://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/62) After clicking the button on the form, the form is unable to respond to the OnKeyDown event. I'm using Small Visual Basic 3.0 to create a typing application. I placed some controls, such as radio buttons and regular buttons, to switch the application status. I found that after interacting with these controls, the form is no longer able to respond to the OnKeyDown event. I believe this is a bug. — Reply to this email directly, view it on GitHub<#62https://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/62>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVU3ZU5TXAH4LPP5F3LZAKW3FAVCNFSM6AAAAABHEPK4USVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI3TMNJUGU4DQOI. You are receiving this because you are subscribed to this thread.Message ID: @.>

You are right, in OnPreviewKeyDown event, the form can always receive the keyboard key event. I remember I asked a question about event related issue before, that was about four months ago, a little bit forgetful, that is about the event propagation path issue. I have noted that. I have started to program using Small Visual Basic recently again, and I am very glad to see the 3.0 version is released, it is much easier to use than before. I will promote Small Visual Basic vigorously in China. Thank you. (Translated by AI)

— Reply to this email directly, view it on GitHubhttps://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/62#issuecomment-2092085330, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVWJDY6U6KNBYUQTPUDZAMESVAVCNFSM6AAAAABHEPK4USVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJSGA4DKMZTGA. You are receiving this because you commented.Message ID: @.***>