@filipemsbaptista wrote:
Hi,
I want to save the name of a selected item from a dropdwon list into a string variable.
I'm doing this in the 'guiEvent' method
void ParametersList::guiEvent(ofxUIEventArgs &e){ string name = e.widget->getName(); if(name == "Timestamps") { ofxUIDropDownList *ddlist = (ofxUIDropDownList *) e.widget; vector<ofxUIWidget *> &selectedItem = ddlist->getSelected(); for(int i = 0; i < selectedItem.size(); i++){ cout << "TIMESTAMP SELECTED: " << selectedItem[i]->getName() << endl; timestampSelected = selectedItem[i]->getName(); } }
}
However, when i do "timestampSelected = selectedItem[i]->getName();" the program breaks with the following message:
"Unhandled exception at 0x5C76EB90 (msvcr110d.dll) in editorGUI_Test_debug.exe: 0xC0000005: Access violation writing location 0xCCCCCCCC."Btw, 'timestampSeçected' is a string variable from the class 'ParamtersList' itself.
I can see that the 'guiEvent' method is somehow blind to the rest of the class objects.
How can I do this in a proper way?Thanks in advance!
Posts: 2
Participants: 1