artvl21 / controlp5

Automatically exported from code.google.com/p/controlp5
0 stars 0 forks source link

moveTo(Tab) doesn't work for ListBoxes #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
===========Example:

controller = new ControlP5(this);
controlWindow = controller.addControlWindow("Controls", 100, 100, 500, 500);
controlWindow.hideCoordinates();
Tab aTab = new Tab(controller, controlWindow, "ATab");
Knob aKnob = controller.addKnob("A Knob", 0, 1000, 300, 150, 150, 50);

//Knob will be there
aKnob.moveTo(aTab);

ListBox aListBox = controller.addListBox("a listbox", 50, 50, 200, 200);
aListBox.addItem("Item 1", 1);
aListBox.addItem("Item 2", 2);

//Won't work
aListBox.moveTo(aTab);

//Works
aListBox.moveTo(null, aTab, controlWindow);

===========

This is due to Knob.moveTo(theTab) is Controller.moveTo(theTab), which 
determines the window by asking theTab.

ListBox.moveTo(theTab) is ControllerGroup.moveTo(theTab), which just nulls it.

I would recommend patching ControllerGroup class like so:

===ORIG
    public void moveTo(Tab theTab) {
        moveTo(null, theTab, null);
    }
===ORIG

===PATCH
    public void moveTo(Tab theTab) {
        moveTo(null, theTab, theTab.getWindow());
    }
===PATCH

Original issue reported on code.google.com by the.lo...@gmail.com on 14 May 2011 at 3:41

GoogleCodeExporter commented 8 years ago
here aListBox.moveTo(aTab,controlWindow); will work.
will include the patch with next release (0.6.0)

Original comment by soj...@gmail.com on 26 Jun 2011 at 5:25