help with listbox's

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: help with listbox's

Postby Ident » Mon May 18, 2020 17:44

What is the body of this select() function? it is not a CEGUI function or is it?
CrazyEddie: "I don't like GUIs"

orion
Not too shy to talk
Not too shy to talk
Posts: 28
Joined: Fri Apr 24, 2020 15:56

Re: help with listbox's

Postby orion » Mon May 18, 2020 18:27

sorry should have added it all in previous post

so what i have so far is the list box populating now :)
with the event subscribe which sends me to this

Code: Select all

CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();
    CEGUI::FrameWindow* pk = static_cast<CEGUI::FrameWindow*>( winMgr.loadLayoutFromFile( "book.layout" ) );
    CEGUI::Listbox* list = dynamic_cast<CEGUI::Listbox*>(pk->getChild("LIST"));
   
    MyListItem* item = (MyListItem* )(( const CEGUI::WindowEventArgs& )args ).window;
        if ( item->isSelected() )
        {
           Select_BOOK(item->getID(), pk);
        }

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: help with listbox's

Postby Ident » Mon May 18, 2020 18:34

Did you say when you subscribe the event then it doesn't handle it regularly internally anymore? There should be a bool parameter that regulates if you wanna override the internal behavior or not
CrazyEddie: "I don't like GUIs"

orion
Not too shy to talk
Not too shy to talk
Posts: 28
Joined: Fri Apr 24, 2020 15:56

Re: help with listbox's

Postby orion » Mon May 18, 2020 18:42

not sure i understand :(

my subscribe part is

Code: Select all

list->subscribeEvent(CEGUI::ItemEntry::EventSelectionChanged, CEGUI::Event::Subscriber(&pk::Select, pb));


which take me to the select function

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: help with listbox's

Postby Ident » Mon May 18, 2020 19:31

Sorry i was referring to old functionality. So does this work when you dont subscribe? Can u repeat the issue?
CrazyEddie: "I don't like GUIs"

orion
Not too shy to talk
Not too shy to talk
Posts: 28
Joined: Fri Apr 24, 2020 15:56

Re: help with listbox's

Postby orion » Tue May 19, 2020 19:51

ok so if i dont use the subscribe event

none are highlighted if i then click on one it will highlight but no change to dislay the new values so basically same as it was before except items not highlighted if that helps

you say the subcsribe is old functionality behaveriour ?

what should i be useing for this ?

sorry if thats a dumb Q but kinda lost here at the moment as you may have guessed :)

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: help with listbox's

Postby Ident » Wed May 20, 2020 22:07

I think the subscribe stuff is new and its fine to use it but honestly i dont know it too well
CrazyEddie: "I don't like GUIs"

orion
Not too shy to talk
Not too shy to talk
Posts: 28
Joined: Fri Apr 24, 2020 15:56

Re: help with listbox's

Postby orion » Sun May 24, 2020 07:23

so as im not having to much joy here could you show me how you would do this

dont mean to be a pain but i really am not getting it at the moment :(

with the code above it just dosnt seem to pass the id over so all that happens is the selection brush moves to the item i clicked on

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: help with listbox's

Postby Ident » Sun May 24, 2020 19:11

When i look for listboxitems i see them mostly used for multicolumnlists and the combobox.

Can you describe exactly what you try to achieve and have you gotten the samplebrowser to run and looked at how something similar is done there? There have been soem larger changes between 0.7 and 0.8 so the approach might be invalid now that you follow?
CrazyEddie: "I don't like GUIs"

orion
Not too shy to talk
Not too shy to talk
Posts: 28
Joined: Fri Apr 24, 2020 15:56

Re: help with listbox's

Postby orion » Thu May 28, 2020 15:52

Hi Ident,

sorry for late reply been busy here :(

what i'm trying to do here is read a .ini file put the description in the listbox andotherbits in to a couple of editbox's this part i got working fine on startup it reads all the .ini file and adds the descriptions in the listbox great :)

but what is not working is when i click on another item entry it changes the editbox's i have it down because the listbox entry is not passing the ID over to the subscribed event
still trying to get the samplebrowser to work but looking at the code for the WidetDemo it has

Code: Select all

d_widgetSelectorListbox->subscribeEvent(CEGUI::Listbox::EventSelectionChanged, Event::Subscriber(&WidgetDemo::handleWidgetSelectionChanged, this));   

so i think i'm on the right track if i can get the ID passed over :oops:

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: help with listbox's

Postby Ident » Thu May 28, 2020 21:26

What means "not passing the ID over"?
CrazyEddie: "I don't like GUIs"

orion
Not too shy to talk
Not too shy to talk
Posts: 28
Joined: Fri Apr 24, 2020 15:56

Re: help with listbox's

Postby orion » Fri May 29, 2020 14:02

so what i mean is

each of the listbox items should have its own ID 1 - how many is in the list i.e
1
2
3
4
etc,etc

now if i click on one it should pass that ID over to the selection function

Code: Select all

CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();
    CEGUI::FrameWindow* pk = static_cast<CEGUI::FrameWindow*>( winMgr.loadLayoutFromFile( "book.layout" ) );
    CEGUI::Listbox* list = dynamic_cast<CEGUI::Listbox*>(pk->getChild("LIST"));
   
    MyListItem* item = (MyListItem* )(( const CEGUI::WindowEventArgs& )args ).window;
        if ( item->isSelected() )
        {
           Select_BOOK(item->getID(), pk);
        }


but that dont seem to be happening the list item does get highlighted fine but the select state dont get passed over noor the ID
but if i add this into the above just for testing

Code: Select all

list->setID(1);;
   item->setSelected(true);


then it will work but edit boox dont get updated i do have

Code: Select all

box1->invalidate(true)
set to the edit box and can see it should change the text stepping though the locals window


Return to “Help”

Who is online

Users browsing this forum: No registered users and 8 guests