sojamo / controlp5

A gui library for processing.org
GNU Lesser General Public License v2.1
490 stars 142 forks source link

Moving RadioButton or CheckBox into and specific tab results NullPointer #97

Closed Nasker closed 7 years ago

Nasker commented 7 years ago

Hi there,

I'm experiencing this issue with RadioButton and CheckBox when I try to place them into an specific tab. It actually works if I don't move them into any so they appear on the default, but as you can imagine that can not be the case pretty often. I'm attaching the code:

cp5.getController("Arm Position").moveTo("Arm Control"); cp5.getController("Switch Laser").moveTo("Laser Control"); cp5.getController("Laser Power").moveTo("Laser Control"); cp5.getController("CheckBox").moveTo("Drivers Status"); // This line makes it crash

sojamo commented 7 years ago

Hello, this might not be obvious but a CheckBox is of type Group (RadioButton as well), therefore the following should work

cp5.getGroup("CheckBox").moveTo("Drivers Status");

instead of including a code snippet only, a runnable code example would make it easier to identify the problems you are encountering.

Nasker commented 7 years ago

Hi! This solved the problem, thanks! Sorry about only posting the snippet I tried putting the whole thing but the code appeared awfully in the post... Thanks again! Salut!