G4P How to use fireallevents?

Thank you for correcting this. I see now that all of your event handlers have it; I missed it completely. What a silly mistake!

That “should” have fixed it, right?

But I guess I have a gremlin. No joy, unless I change the event type to CLICKED. And in that case, I can just use the GUI Builder with the standard click event.

The following simply does nothing:

void handleImgBtnPrevEvents(GImageButton source, GEvent event) {
   if (event == GEvent.RELEASED){
     println("PREV");
     movePrev();
   }
}//end void

void handleImgBtnNextEvents(GImageButton source, GEvent event) {
   if(event == GEvent.RELEASED){
     println("NEXT");
     moveNext();
   }
}//end void

I don’t expect you to keep trying; I appreciate all you’ve done. You’ve helped me so much, and also all the others that visit here in search of understanding.

If I figure something else out, I’ll post it back. Thank you again Peter. You are simply the best.

Mike

Just because you take your finger off the mouse button does not mean a GEvent.RELEASED event is always fired.

Let me explain …

When the user presses the mouse-button over a GButton and then releases it there are two possibilities they are

  1. GEvent.PRESSED followed by GEvent.CLICKED
    occurs if the mouse has not moved between the mouse being pressed and released

  2. GEvent.PRESSED followed by GEvent.RELEASED
    occurs if the mouse has moved between the mouse being pressed and released

Notice that

  • each possibility fires exactly two events
  • GEvent.CLICKED and GEvent.RELEASED events are never fired together in a single mouse ↔ GButton interaction.
1 Like

et voila.

You explained this before, but I just didn’t get it.

Thank you again; you really helped me out.

I can confirm your explanation works exactly as you described. Now I know how to proceed.

Thank you so much.

Mike

Sorry, aren’t both phrases identical?

_ CLICKED if the mouse has not moved since the PRESSED event
RELEASED if the mouse has not moved since the PRESSED event

edit: saw the corrected version later, but there’s two times the typo version :wink:

@vkbr thanks for pointing that out you are quite correct, the sin of copy and paste LOL :innocent:

I have corrected the posts above, thanks again. :+1:

2 Likes