sVB-Small-Visual-Basic icon indicating copy to clipboard operation
sVB-Small-Visual-Basic copied to clipboard

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

Open dynamicboy opened this issue 1 year ago • 1 comments

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.

dynamicboy avatar Jan 08 '24 23:01 dynamicboy

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: @.***>

VBAndCs avatar Jan 09 '24 00:01 VBAndCs