Standard library button behaviour

 

The onclick event behaviour of the buttons created with the standard library is weird. 

Is there any way to change that? 

For example: if you click on the button object but the mouse pointer is no longer pointing to the button when you release the mouse's left button, that does not fire the ONCLICK event even though the object actually changes the state (OBJPROP_STATE). This can lead to false operations. 

 
Laszlo Tormasi:

The onclick event behaviour of the buttons created with the standard library is weird. 

Is there any way to change that? 

For example: if you click on the button object but the mouse pointer is no longer pointing to the button when you release the mouse's left button, that does not fire the ONCLICK event even though the object actually changes the state (OBJPROP_STATE). This can lead to false operations. 

Then check the state of the button instead of whether it has been clicked.

 
Keith Watford:

Then check the state of the button instead of whether it has been clicked.

The word probably is that there is no chart event referring the button name, so it is tricky to check.

 
Ex Ovo Omnia:

The word probably is that there is no chart event referring the button name, so it is tricky to check.

When a button is clicked it should trigger the Object Click event. I didn't realise that if the mouse is moved before releasing the mouse button that it would change the button state.

I would think that checking the state with the Object Click event and Chart Click event it should cover all?

 
Keith Watford:

When a button is clicked it should trigger the Object Click event. I didn't realise that if the mouse is moved before releasing the mouse button that it would change the button state.

I would think that checking the state with the Object Click event and Chart Click event it should cover all?

Object click event is generated on mouse up, so wherever you click down it has no effect on that event. So if you click on the object A, move your mouse to the B, and release the mouse, the click fires an event with name B.

I have no experience with the button state though.

 
Keith Watford:

When a button is clicked it should trigger the Object Click event. I didn't realise that if the mouse is moved before releasing the mouse button that it would change the button state.

I would think that checking the state with the Object Click event and Chart Click event it should cover all?

The standard library handles this incorrectly so basically all of the GUIs based on the library are not working properly. 

The OnChartEvent fires when the button is clicked but the ONCLICK event doesn't. This is a really annoying bug?? / feature.  

 
Laszlo Tormasi:

The standard library handles this incorrectly so basically all of the GUIs based on the library are not working properly. 

The OnChartEvent fires when the button is clicked but the ONCLICK event doesn't. This is a really annoying bug?? / feature.  

No idea, I am using Edit buttons instead, and render them in the Click event. I do not use the standard library at all.

 
The only way to deal with that correctly is to use CHARTEVENT_MOUSE_MOVE.