Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLUI_List can't find last item #16

Open
josch opened this issue Sep 13, 2015 · 0 comments
Open

GLUI_List can't find last item #16

josch opened this issue Sep 13, 2015 · 0 comments
Labels

Comments

@josch
Copy link
Contributor

josch commented Sep 13, 2015

https://sourceforge.net/p/glui/bugs/21/

initial report

  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

reply 1

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.

@josch josch added the bug label Sep 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant