Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#21 GLUI_List can't find last item

open
nobody
6
2012-07-18
2007-05-24
Anonymous
No

1) make a GLUI_List called lbSeries, put 2 items in it
2) make a button that tries to perform an operation based the selected item's text
3) control_cb callback for the button click:
int id= lbSeries->get_current_item();
GLUI_List_Item* item = lbSeries->get_item_ptr(id);
engine->DoSomething(std::string(item->text.c_str()));

Works fine for the 1st item in the list. For item #2, lbSeries->get_item_ptr(1) always returns NULL, even though the current item selected is id==1

Discussion

  • Billy B
    Billy B
    2007-08-28

    Logged In: YES
    user_id=821871
    Originator: NO

    This is because get_item_ptr works off id's (which are intrinsic to list items) while get_current_item returns an ordinal index.

    The list API needs work.

     


Anonymous


Cancel   Add attachments