G4P library with GUI builder - Drop down list

Peter I hope you read this, need some guidance please,

I am using for the first time the drop down, I have a list of 10 options but all I get is
dropList1 - GDropList >> GEvent.SELECTED @ 14368
dropList1 - GDropList >> GEvent.SELECTED @ 23314

For any of the option I choose.
How do I extract the variable I chose in the option list file?

Thank you

If you look in the gui tab you will see the event handler for your droplist. Inside there you will see the code that produces the output you posted.

You can get the item index and text with

dropList1.getSelectedIndex();  // returns an int
dropList1.getSelectedText();   // returns a String

Make sure any code you add to the gui tab is inside the event handler.

Great, it worked.

Did you write a user guid that explains this?

How to get data from a text box for instance, and other functions?

Thanks a lot, love the library and tool
Mich

PS
Is there a setting the make the click response faster. Meaning, I have to hold the mouse down for about 500mS to get a response. I am powering a robot and I need to turn off motors fast,

Thanks

Do not hold the mouse button down simply click on the button for the drop list to appear

There are guides on my website for G4P, you can look at the API class reference documentation and there are examples that come with the library for you to experiment with.

I am using a checkbox for the first time using the builder.

I looked at the examples but I could not find out how to get the boolean from the box being checked or not,

I tried boolean CkBox = source.getBoolean();

But did not work, Please help
Thank you,
Mitch

You want to use .isSelected() I think.

1 Like

Thanks
That worked. Would it be the same for the Option boxes?

Yes its the same for any control that can be selected / deselected including checkboxes