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.
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.
They are variables created internally by the G4p code. How could I use these variables ??? is there any example ??? Thanks???
Hello,
I just installed the latest library (G4P 4.3.2).
Example sketches are available in the PDE by navigating to:
File > Examples… > Contributed Libraries >
First I suggest that you look at the G4P guides 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
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
/**
* 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 & GOption events <br>
* SELECTED "Option selected <br>
* DESELECTED "Option de-selected <br>
*
*/
Thanks for your illustrative help