sojamo / controlp5

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

When using 2 RadioButtons it does not like the fact that addItems are the same #172

Open Gerriko opened 3 years ago

Gerriko commented 3 years ago

I wanted to create 2 radio button objects which need to display the same information in two different locations.

Despite giving each addRadioButton different names (radioButton1 & radioButton2), the library gives an error for duplicate addItems found and only displays the 2nd option:

WARNING: Controller with name "/50" already exists. overwriting reference of existing controller. Aug 20, 2021 11:01:06 AM controlP5.ControlP5 checkName

r1 = cp5.addRadioButton("radioButton1")
         .setPosition(100,180)
         .setSize(20,20)
         .setColorForeground(color(120))
         .setColorActive(color(255))
         .setColorLabel(color(255))
         .setItemsPerRow(5)
         .setSpacingColumn(50)
         .addItem("50",1)
         .addItem("100",2)
         .addItem("150",3)
         ;

  r2 = cp5.addRadioButton("radioButton2")
         .setPosition(200,180)
         .setSize(20,20)
         .setColorForeground(color(120))
         .setColorActive(color(255))
         .setColorLabel(color(255))
         .setItemsPerRow(5)
         .setSpacingColumn(50)
         .addItem("50",1)
         .addItem("100",2)
         .addItem("150",3)
         ;