Problem with removing widgets #31

Closed
sy1vain opened this Issue Jun 6, 2012 · 2 comments

2 participants

@sy1vain

There is a problem with the removal of widgets.

To compare widgets you use the getName() function. But since this name is not always unique, one can run into trouble. For instance:

ofxUICanvas *canvas = new ofxUICanvas();

ofxUIButton *button1 = new ofxUIButton(20, 20, false, "button");
ofxUIButton *button2 = new ofxUIButton(20, 20, false, "button");

canvas->addWidgetDown(button1);
canvas->addWidgetDown(button2);

canvas->removeWidget(button2);

will always crash. This is because both have the same name internally. So when removing widget 2, you actually remove widget 1 from the widgets list but delete widget 2 from memory (but is still in the list). So either check for the object or add an unique identifier to check if they are the same.

@rezaali
Owner

there is already a unique identifier assigned to each widgets, I need to figure out whats the best way of deleting widgets...when I originally designed the UI, I didn't intend for it to become so...extended...but will work on this...

@rezaali
Owner

This should be fixed, please try out the latest dev version and open another issue if its isn't.

@rezaali rezaali closed this Aug 14, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment