# G4P How to use fireallevents?

**URL:** https://discourse.processing.org/t/g4p-how-to-use-fireallevents/44435
**Category:** Libraries
**Created:** [May 15, 2024, 7:14pm UTC](https://discourse.processing.org/t/g4p-how-to-use-fireallevents/44435 "2024-05-15T19:14:37Z")
**Posts on this page:** 5
**Page:** 2

<div class="post-metadata">

### Author: ![Thundercat](https://avatars.discourse-cdn.com/v4/letter/t/dbc845/32.png) [@Thundercat](https://discourse.processing.org/u/Thundercat)
#### Post date: [May 17, 2024, 8:32pm UTC](https://discourse.processing.org/t/g4p-how-to-use-fireallevents/44435/21 "2024-05-17T20:32:36Z")

</div>

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:

```auto
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

---

<div class="post-metadata">

### Author: ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)
#### Post date: [May 17, 2024, 9:06pm UTC](https://discourse.processing.org/t/g4p-how-to-use-fireallevents/44435/22 "2024-05-17T21:06:49Z")

</div>

> _ **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.

---

<div class="post-metadata">

### Author: ![Thundercat](https://avatars.discourse-cdn.com/v4/letter/t/dbc845/32.png) [@Thundercat](https://discourse.processing.org/u/Thundercat)
#### Post date: [May 17, 2024, 9:39pm UTC](https://discourse.processing.org/t/g4p-how-to-use-fireallevents/44435/23 "2024-05-17T21:39:20Z")

</div>

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

---

<div class="post-metadata">

### Author: ![vkbr](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/vkbr/32/16844_2.png) [@vkbr](https://discourse.processing.org/u/vkbr)
#### Post date: [May 23, 2024, 3:38am UTC](https://discourse.processing.org/t/g4p-how-to-use-fireallevents/44435/24 "2024-05-23T03:38:38Z")

</div>

Sorry, aren’t both phrases identical?

> [@quark](#):
>
> - CLICKED if the mouse has not moved since the PRESSED event
> - RELEASED if the mouse has not moved since the PRESSED event

\_ 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 😉

---

<div class="post-metadata">

### Author: ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)
#### Post date: [May 23, 2024, 9:29am UTC](https://discourse.processing.org/t/g4p-how-to-use-fireallevents/44435/25 "2024-05-23T09:29:43Z")

</div>

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

I have corrected the posts above, thanks again. 👍

[Previous page](https://discourse.processing.org/t/g4p-how-to-use-fireallevents/44435.md?page=1)
