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
232 stars 16 forks source link

The text of the buttons does not respond to the OnDoubleClick event. #49

Closed dynamicboy closed 3 months ago

dynamicboy commented 9 months ago

Version: 2.8.8.1 Detail: Double clicking the text of a button and togglebutton does not raise the OnDoubleClick event, but the space between the text and the border does.

Step 1: Drag a button and a togglebutton onto the form. Step 2: In the Form Code editor, input the following codes:

'------------------------------------------------
Sub Button1_OnDoubleClick()
   TW.WriteLine("Button1 double clicked!")
EndSub
'------------------------------------------------
Sub ToggleButton1_OnDoubleClick()
   TW.WriteLine("ToggleButton1 double clicked!")
EndSub

Step 3: Run the form. Step 4: Double click the space between the text and the border of the two buttons. The TextWindow prints the screenshot as shown below: 2024-01-09_071756

However, when I double click the text "Button1" and "ToggleButton1", I do not see anything new in the TextWindow.

VBAndCs commented 9 months ago

There is no logical reason to handle the OnDoubleClick event for the buttons family. So, this is not an actual issue to fix.

You also should not use the OnClick of some controls like RadioButton, ChickBox, ListBox, Slider and ScrolBar. Some of these controls will have issues with this event, but you will never need to use it. But if you insist, you can use the OnMouseLeftUp event instead.

I am gathering most events in the Control class to simplify coding on me, and this shows these events for all controls, but this doesn't mean they are all useful for every control. You just need to use the event that will actually do the job.

Thanks


From: dynamicboy @.> Sent: Monday, January 8, 2024 11:20 PM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Subscribed @.***> Subject: [VBAndCs/sVB-Small-Visual-Basic] The text of the buttons does not respond to the OnDoubleClick event. (Issue #49)

Version: 2.8.8.1 Detail: Double clicking the text of a button and togglebutton does not raise the OnDoubleClick event, but the space between the text and the border does.

Step 1: Drag a button and a togglebutton onto the form. Step 2: In the Form Code editor, input the following codes:

'------------------------------------------------ Sub Button1_OnDoubleClick() TW.WriteLine("Button1 double clicked!") EndSub '------------------------------------------------ Sub ToggleButton1_OnDoubleClick() TW.WriteLine("ToggleButton1 double clicked!") EndSub

Step 3: Run the form. Step 4: Double click the space between the text and the border of the two buttons. The TextWindow prints the screenshot as shown below: 2024-01-09_071756.png (view on web)https://github.com/VBAndCs/sVB-Small-Visual-Basic/assets/7421525/b397e67f-98a9-4cff-948a-88e774b26743

However, when I double click the text "Button1" and "ToggleButton1", I do not see anything new in the TextWindow.

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