Mouse handling at buttons

Posted By: Aku_Aku

Mouse handling at buttons - 12/21/14 13:09

From the atypes.h
Code:
#define EVENT_CLICKUP		14	// left click over down toggle
#define EVENT_BUTTONUP		15	// mouse button released over entity
#define EVENT_TOUCH		16	// mouse pointer moves over entity
#define EVENT_RELEASE		17	// mouse pointer leaves entity
#define EVENT_CLICK		18	// left click over entity
#define EVENT_RIGHTCLICK 	19	// right click over entity


I wrote a little code that tries to detect what happened...
It is a panel with one button on it.
Code:
function btn_mouse() {
	printf("btn_mouse event_type %d",(long)event_type);
	if (event_type == EVENT_CLICK) {
		printf("btn_mouse EVENT_CLICK");
	}
	if (event_type == EVENT_RIGHTCLICK) {
		printf("btn_mouse EVENT_RIGHTCLICK");
	}
	if (event_type == EVENT_TOUCH) {
		printf("btn_mouse EVENT_TOUCH");
	}
	if (event_type == EVENT_RELEASE) {
		printf("btn_mouse EVENT_RELEASE");
	}
	if (event_type == EVENT_CLICKUP) {
		printf("btn_mouse EVENT_CLICKUP");
	}
	if (event_type == EVENT_BUTTONUP) {
		printf("btn_mouse EVENT_BUTTONUP");
	}


I was surprised when my code showed only two event types EVENT_RELEASE and EVENT_BUTTONUP.
What did i do wrong or what did i miss?
My system is A7 with latest patch.
Posted By: jcl

Re: Mouse handling at buttons - 12/31/14 08:08

Have you set enable_mouse to 2?
Posted By: Aku_Aku

Re: Mouse handling at buttons - 12/31/14 11:35

No, i didn't.

I used this statement:
mouse_mode = 4;
I thought it is good for testing this behaviour.
Let me know if i am wrong.
Posted By: Aku_Aku

Re: Mouse handling at buttons - 01/03/15 17:52

Well i gave a try to the enable_mouse = 2 setting.
Nothing was changed.
Do you have another suggestion?
Thanks in advance...
Posted By: jcl

Re: Mouse handling at buttons - 01/06/15 11:46

Hmm, it works here with the code from the manual. Have you set the panel event? Note it's not the button, it's the panel that reacts on the mouse click and sets the event type.
Posted By: Aku_Aku

Re: Mouse handling at buttons - 01/07/15 19:27

Maybe i wasn't clear enough.
My code checks the events attached to a button.
So i don't think, i should set any panel event.
Does it change something?
Posted By: jcl

Re: Mouse handling at buttons - 01/12/15 15:29

Yes! I thought you meant a panel mouse event.

The buttons have different actions according to the button() definition, I don't know if they use the event type at all.
Posted By: FBL

Re: Mouse handling at buttons - 06/02/15 17:55

It would be nice if they did... and if they also reacted on rightclick...
© 2024 lite-C Forums