@@ -10,16 +10,16 @@ class ChannelSelect {
1010 protected boolean channelSelectHover;
1111 protected boolean isVisible;
1212
13- ChannelSelect (PApplet _parent , int _x , int _y , int _w , int _navH ) {
13+ ChannelSelect (PApplet _parentApplet , int _x , int _y , int _w , int _navH ) {
1414 x = _x;
1515 y = _y;
1616 w = _w;
1717 h = _navH;
1818 navH = _navH;
1919
2020 // setup for checkboxes
21- cp5_chanSelect = new ControlP5 (_parent );
22- cp5_chanSelect. setGraphics(_parent , 0 , 0 );
21+ cp5_chanSelect = new ControlP5 (_parentApplet );
22+ cp5_chanSelect. setGraphics(_parentApplet , 0 , 0 );
2323 cp5_chanSelect. setAutoDraw(false ); // draw only when specified
2424 }
2525
@@ -66,8 +66,8 @@ class ChannelSelect {
6666 popStyle ();
6767 }
6868
69- public void screenResized (PApplet _parent ) {
70- cp5_chanSelect. setGraphics(_parent , 0 , 0 );
69+ public void screenResized (PApplet _parentApplet ) {
70+ cp5_chanSelect. setGraphics(_parentApplet , 0 , 0 );
7171 }
7272
7373 public void mousePressed (boolean dropdownIsActive ) {
@@ -111,8 +111,8 @@ class ExGChannelSelect extends ChannelSelect {
111111 protected List<Toggle > channelButtons;
112112 private List<Integer > activeChannels = new ArrayList<Integer > ();
113113
114- ExGChannelSelect (PApplet _parent , int _x , int _y , int _w , int _navH ) {
115- super (_parent , _x, _y, _w, _navH);
114+ ExGChannelSelect (PApplet _parentApplet , int _x , int _y , int _w , int _navH ) {
115+ super (_parentApplet , _x, _y, _w, _navH);
116116 createButtons();
117117 }
118118
@@ -232,6 +232,17 @@ class ExGChannelSelect extends ChannelSelect {
232232 return activeChannels;
233233 }
234234
235+ public void updateChannelSelection (List<Integer > channels ) {
236+ // First deactivate all channels
237+ deactivateAllButtons();
238+
239+ // Then activate only the selected channels
240+ for (Integer channel : channels) {
241+ if (channel >= 0 && channel < channelButtons. size()) {
242+ setToggleState(channel, true ); // Changed from toggleButton
243+ }
244+ }
245+ }
235246}
236247
237248class DualChannelSelector {
@@ -282,8 +293,8 @@ class DualExGChannelSelect extends ExGChannelSelect {
282293
283294 DualChannelSelector dualChannelSelector;
284295
285- DualExGChannelSelect (PApplet _parent , int _x , int _y , int _w , int _navH , boolean isFirstRow ) {
286- super (_parent , _x, _y, _w, _navH);
296+ DualExGChannelSelect (PApplet _parentApplet , int _x , int _y , int _w , int _navH , boolean isFirstRow ) {
297+ super (_parentApplet , _x, _y, _w, _navH);
287298 dualChannelSelector = new DualChannelSelector (isFirstRow);
288299 }
289300
0 commit comments