twinbasic / twinbasic

289 stars 24 forks source link

Feature request : As per VB6 IDE - Delete unwanted, automatically created, empty event routine remnants #1944

Open yereverluvinunclebert opened 6 days ago

yereverluvinunclebert commented 6 days ago

Feature request - As per VB6 IDE - dbl clicking on a control opens the default event, the click event, If the click event does not exist, TB creates it as per VB6 If I then select a mouseDown event in the dropdowns for this control, then make a change on another valid event trigger, Then save the code, rady for running. I find that the unwanted and empty, automatically created, "click event routines" are still there, unlike VB6 VB6 removes these empty routines on the next save.

I'm sure this will be sorted in the natural run of things. I'll just leave this here as a reminder.

fafalone commented 6 days ago

Do you have an addin that might be doing that? I've never seen VB6 delete unused event handlers. Just tried to get it to do that and couldn't.

yereverluvinunclebert commented 6 days ago

Apologies, my description is faulty. It should state "VB6 removes these empty routines on the next save, and compile". That is the squence of events I follow when I know the empty routines disappear.

When the VB6 code is compiled it removes the empty and unused or accidentally declared event routines. I find it most useful, otherwise you are left with discarded empty click routines. The way I navigate my code is from the VB6 form, if I want to see what a control is doing I double click on the control. If the control is handled using mouseDown or other event, any spurious click event that VB6 generates when navigating to the control's code will be tidied by VB6 on the next compile.

Test that and see if it is default VB6 behaviour. I think it is, though I am happy to be proven wrong.

I need to go and check TwinBasic now, to make myself certain it does it differently.

I just checked, if I have a slider with the name sliGaugeSize and it is handled using the sliGaugeSize_change event, when I double click on that form in VB6 it opens the existing CHANGE event. In TB it does not. It creates a new CLICK event even though the CHANGE event exists.

In addition, in VB6 if I create an empty CLICK event for sliGaugeSize then compile, it disappears. In TB it stays, TB generating multiple empty click events as I navigate around the form by dbl clicking on controls. as I see fit. Trust me, that is the way I and others do navigate a form.