# G4P TOOL and code

**URL:** <https://discourse.processing.org/t/g4p-tool-and-code/18095>\
**Category:** Processing\
**Created:** [February 25, 2020, 9:33am UTC](https://discourse.processing.org/t/g4p-tool-and-code/18095 "2020-02-25T09:33:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Theo68](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/theo68/32/8138_2.png) [@Theo68](https://discourse.processing.org/u/Theo68)\
**Post date:** [February 25, 2020, 9:33am UTC](https://discourse.processing.org/t/g4p-tool-and-code/18095/1 "2020-02-25T09:33:26Z")

</div>

I’ve created a window that has a button that opens a 2nd window. The code shows an orange underlining some worries but I do not understand what is missing. The code runs normally.

 ![G4p warnings](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/b/b1f5ca691869788e6f67d9b2915e055f9cae266c.jpeg)

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [February 25, 2020, 9:35am UTC](https://discourse.processing.org/t/g4p-tool-and-code/18095/2 "2020-02-25T09:35:56Z")

</div>

Normally when you move cursor on the word a message is shown on the lower side of the screen

The orange are variables that are not used.

---

<div class="post-metadata">

**Author:** ![Theo68](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/theo68/32/8138_2.png) [@Theo68](https://discourse.processing.org/u/Theo68)\
**Post date:** [February 25, 2020, 11:01am UTC](https://discourse.processing.org/t/g4p-tool-and-code/18095/3 "2020-02-25T11:01:22Z")

</div>

They are variables created internally by the G4p code. How could I use these variables ??? is there any example ??? Thanks???

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [February 25, 2020, 12:05pm UTC](https://discourse.processing.org/t/g4p-tool-and-code/18095/4 "2020-02-25T12:05:53Z")

</div>

Hello,

> [@Theo68](#):
>
> is there any example ?

I just installed the latest library (G4P 4.3.2).  
Example sketches are available in the PDE by navigating to:  
File \> Examples… \> Contributed Libraries \>

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/c/c8a35f0c6cd55f8af48fbc0a37e0741e0c7af2e9.png)

---

<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:** [February 26, 2020, 9:14am UTC](https://discourse.processing.org/t/g4p-tool-and-code/18095/5 "2020-02-26T09:14:15Z")

</div>

First I suggest that you look at the [G4P guides](http://www.lagers.org.uk/g4p/guides/g01-introduction.html) for more information on event handlers and other G4P matters.

As Chrisir pointed out the orange wavy lines are warnings that these function parameters are not being used inside the function and can be ignored.

Not in your code you have

```auto
synchronized public void win_draw1(PAppelt appc, GWinData data){

```

Noticed that the `appc` is not underlined because it is used in the very next statement  
`appc.background(230);`

In the first function you have `source` which is the button that generated the event which can be useful if you want to modify the button. For instance every time you click this button you will get a new window. if you only want the button to work once, then add the code `source.setEnabled(false);` inside the event handler.

`event` is the event generated by the `source`, for buttons you just have the `GEvent.CLICKED` but some controls can generate more than one type of event and you might want to do something different based on the event type.

Here is a full list copied from the source file `GEvent.java`

```auto
/**
 * Enumeration of events that can be fired by G4P. <br>
 * 
 * GTextField and GTextArea events <br>
 * CHANGED Text has changed <br>
 *	SELECTION_CHANGED Text selection has changed <br>
 *	ENTERED Enter/return key typed <br>
 *	LOST_FOCUS TextField/Area lost focus <br>
 *	GETS_FOCUS TextField/Area got focus <br>
 *
 * GPanel events <br>
 *	COLLAPSED Control was collapsed <br>
 *	EXPANDED Control was expanded <br>
 *	DRAGGED Control is being dragged <br>
 *
 * Button control events (PRESSED and RELEASED are not fired by default)
 *	CLICKED Mouse button was clicked <br>
 *	PRESSED Mouse button was pressed <br>
 *	RELEASED Mouse button was released <br>
 *
 * Slider control events events <br>
 *	VALUE_CHANGING Value is changing <br>
 *	VALUE_STEADY Value has reached a steady state <br>
 *	DRAGGING The mouse is being dragged over a component <br>
 *
 * GCheckbox &amp; GOption events <br>
 *	SELECTED "Option selected <br>
 *	DESELECTED "Option de-selected <br>
 *
 */

```

---

<div class="post-metadata">

**Author:** ![Theo68](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/theo68/32/8138_2.png) [@Theo68](https://discourse.processing.org/u/Theo68)\
**Post date:** [February 26, 2020, 6:03pm UTC](https://discourse.processing.org/t/g4p-tool-and-code/18095/6 "2020-02-26T18:03:36Z")

</div>

Thanks for your illustrative help
