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

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

help with listbox's

Postby orion » Sat May 09, 2020 03:04

Hi All

been trying to sort this out for a while and if i had hair to loose yup its gone :)

so i did work in v7 of cegui and porting it over to v8 ran into a prob what i'am trying to do is fill a listbox from a .ini file
if i step though the code i get the description form the ini file just fine but nothing appears in the item listbox and i mean nothing nada cilch
used to be ok with .getWindow old way i know so i'm pretty sure it has to with the tlist part but unsure what it is
"LIST" is the itemlistbox name in the book.layout file
anyways here the code any help kindly recived

Code: Select all

CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();
    CEGUI::FrameWindow* pb = static_cast<CEGUI::FrameWindow*>( winMgr.loadLayoutFromFile( "book.layout" ) );


   
    entry= Book->GetCurrentPtr();

    while ( entry )
    {
        CEGUI::ItemListbox* tlist = static_cast<CEGUI::ItemListbox*>(winMgr.createWindow("TaharezLook/ItemListbox", "LIST" ));
        pb->getChild("LIST");
        // create new list item
         CEGUI::ItemEntry* pitem = static_cast<CEGUI::ItemEntry*>(winMgr.createWindow("TaharezLook/ListboxItem"));

         
         tlist->addItem(pitem);
                 // set text on this item to whatever name's are in the ini file
        pitem->setText( entry->description );


       pitem->setSelected( true );

       tlist->invalidate();
        tlist->show();
    }

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 15, 2020 14:35

sorry forgot to add the log file i have also seached around and loooked at

http://cegui.org.uk/wiki/CEGUI_In_Practice_-_A_Game_Console
for help but i cant seem toget the items dispalyed :(

Code: Select all

11/05/2020 18:40:44 (Std)         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
11/05/2020 18:40:44 (Std)         +                     Crazy Eddie's GUI System - Event log                    +
11/05/2020 18:40:44 (Std)         +                          (http://www.cegui.org.uk/)                         +
11/05/2020 18:40:44 (Std)         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

11/05/2020 18:40:44 (Std)         CEGUI::Logger singleton created. (0000000028D22E20)
11/05/2020 18:40:44 (Std)
11/05/2020 18:40:44 (Std)         ********************************************************************************
11/05/2020 18:40:44 (Std)         * Important:                                                                   *
11/05/2020 18:40:44 (Std)         *     To get support at the CEGUI forums, you must post _at least_ the section *
11/05/2020 18:40:44 (Std)         *     of this log file indicated below.  Failure to do this will result in no  *
11/05/2020 18:40:44 (Std)         *     support being given; please do not waste our time.                       *
11/05/2020 18:40:44 (Std)         ********************************************************************************
11/05/2020 18:40:44 (Std)         ********************************************************************************
11/05/2020 18:40:44 (Std)         * -------- START OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM       -------- *
11/05/2020 18:40:44 (Std)         ********************************************************************************
11/05/2020 18:40:44 (Std)         ---- Version: 0.8.7 (Build: Apr 27 2020 Static Microsoft Windows MSVC++ Unknown MSVC++ version 64 bit) ----
11/05/2020 18:40:44 (Std)         ---- Renderer module is: CEGUI::Direct3D11Renderer - Official Direct3D 11 based 2nd generation renderer module. ----
11/05/2020 18:40:44 (Std)         ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
11/05/2020 18:40:44 (Std)         ---- Image Codec module is: SILLYImageCodec - Official SILLY based image codec ----
11/05/2020 18:40:44 (Std)         ---- Scripting module is: None ----
11/05/2020 18:40:44 (Std)         ********************************************************************************
11/05/2020 18:40:44 (Std)         * -------- END OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM         -------- *
11/05/2020 18:40:44 (Std)         ********************************************************************************

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

Re: help with listbox's

Postby Ident » Fri May 15, 2020 16:29

Have you looked at the sample code for comparison? There are many examples of Listbox usages afaik, and if it works there it must work for you too :) (or at least we can compare what's different and figure this out)
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 15, 2020 16:40

Hi Ident,

thanks for getting back to me

indeed i have looked though the samples and threads here aswell and as far as i can tell it should be ok

i've set up some break points aswell and it says it is populating the listbox fine but just dont show anything at all same with editbox aswell btw

in code i set up the editbox like so

Code: Select all

CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();
    CEGUI::FrameWindow* bk = static_cast<CEGUI::FrameWindow*>(winMgr.loadLayoutFromFile("bk.layout"));
CEGUI::Editbox* con = static_cast<CEGUI::Editbox*>(bk->getChild("connection"));
con->setText("DOES THIS WORK");


but nada still empty box just like the listbox so i'm missing something here i'm sure of it
i've triued is Active and show but no go aswell

the layout gets loaded fine i.e i can see the framewindow and all the widgets :oops:

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

Re: help with listbox's

Postby Ident » Fri May 15, 2020 16:43

The looknfeel and scheme files are updated? Do editboxes ever work?
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 15, 2020 16:54

ok so the way i understand now in 8.7 is

load the layout
then getChild is the widgets from the layout

Code: Select all

<Window type="TaharezLook/FrameWindow" name="bookwindow_" >


so child would be anything below that ?

soo at moment i have a button on the root that loads a framewindow this dispalys fine but then thats where my problems come in to play

should i be recalling

Code: Select all

 CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()

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

Re: help with listbox's

Postby Ident » Fri May 15, 2020 17:03

Yes you attach your loaded layout to that root and then you modify it through that hierarchy. Does that help?
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 15, 2020 17:36

Sort of yeah

i added that CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->getChild(bk);

but still no go here i can manually add text in all the editboxes when its dispalyed in UI so there all active ok but damn if i can see where i'm going wrong here with populating them with the code it's going to be something so stupid i can see it coming :hammer:

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 15, 2020 18:29

hmm just a quick one

CEGUI::ListboxTextItem* list_item

do i need to add this as a child of the listbox ?


just so you can see it should be populating the boxes

Image

i alsotried con->notifyScreenAreaChanged(); but that didnt work :{

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

Re: help with listbox's

Postby Ident » Fri May 15, 2020 20:43

Have you run the samples and tried to copy over what they do piece by piece to eliminate the difference between what you do and what the sample does?
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 » Sat May 16, 2020 15:35

how do you run the samples ?

i build CEGUI and all went fine but no where do i see for example demo6.exe or anything ?

i have just been looking though the .cpp files to help me this far

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 » Sat May 16, 2020 16:56

ok so i started the code from fresh using the widgetDemo for refrence


code as it is now looks

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 = new MyListItem( "PLEASE WORK");
         // add this item to the listbox
         list->addItem(item);           

    list->isActive();
    list->show();
    list->notifyScreenAreaChanged();

and the class

Code: Select all

class MyListItem : public CEGUI::ListboxTextItem
{
public:
    MyListItem(const CEGUI::String& text, CEGUI::uint item_id = 0) :
        ListboxTextItem(text, item_id)
    {
        setSelectionBrushImage("TaharezLook/ListboxSelectionBrush");
    }
};


but still nothing shows :(

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 17, 2020 11:19

standard cmake config should build the samplebrowser, which contains all samples, run the samplebrowser and check out if things work there please.

it is really difficult to distant diagnose "doesnt work" "doesnt show" issues, i feel kind of blind here :P so far i could only point you to things you can investigate, now i suggest to check if it ever works at all and then compare from there. it is what i d do
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 14:06

Yeah i understand the distance diagnosing problem :( appreciate the help thus far though

ok i can see the samplebrouser datafiles but in the bin directory i dont see the samplebrowser.exe i do have the sampleframework.exe ones but they complain of missing dll's which seems strange as i build the deps and cegui as per requirements and in right order so not sure on that one

thing is i'm porting the code over which makes it even harder as it used to work fine lol so i just have to understand what i doing wrong and slap myself when it gets resolved because i know its going to be something stupid on my end :hammer:

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 16:48

okay getting closer :)

i had to pass the framewindow diffrently from the button and it now loads the data into the listbox yippee :)

but gave me a new prob :mrgreen:
when i add

Code: Select all

item->setSelected(true);


it sets both items to the select state bahhh and the next one is if i click on one of the items using

Code: Select all

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


it dosnt pass the select state so that the select never passes to the

Code: Select all

select(item->getID(), pk);
part :hammer:

Code: Select all

MyListItem* item = (MyListItem* )(( const CEGUI::WindowEventArgs& )args ).window;
        if ( item->isSelected() )
        {
           select(item->getID(), pk);
        }


Return to “Help”

Who is online

Users browsing this forum: No registered users and 11 guests