Page 1 of 2
help with listbox's
Posted: Sat May 09, 2020 03:04
by orion
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();
}
Re: help with listbox's
Posted: Fri May 15, 2020 14:35
by orion
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_Consolefor 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) ********************************************************************************
Re: help with listbox's
Posted: Fri May 15, 2020 16:29
by Ident
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)
Re: help with listbox's
Posted: Fri May 15, 2020 16:40
by orion
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

Re: help with listbox's
Posted: Fri May 15, 2020 16:43
by Ident
The looknfeel and scheme files are updated? Do editboxes ever work?
Re: help with listbox's
Posted: Fri May 15, 2020 16:54
by orion
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()
Re: help with listbox's
Posted: Fri May 15, 2020 17:03
by Ident
Yes you attach your loaded layout to that root and then you modify it through that hierarchy. Does that help?
Re: help with listbox's
Posted: Fri May 15, 2020 17:36
by orion
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

Re: help with listbox's
Posted: Fri May 15, 2020 18:29
by orion
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

i alsotried con->notifyScreenAreaChanged(); but that didnt work :{
Re: help with listbox's
Posted: Fri May 15, 2020 20:43
by Ident
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?
Re: help with listbox's
Posted: Sat May 16, 2020 15:35
by orion
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
Re: help with listbox's
Posted: Sat May 16, 2020 16:56
by orion
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

Re: help with listbox's
Posted: Sun May 17, 2020 11:19
by Ident
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

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
Re: help with listbox's
Posted: Mon May 18, 2020 14:06
by orion
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

Re: help with listbox's
Posted: Mon May 18, 2020 16:48
by orion
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
when i add
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
part
Code: Select all
MyListItem* item = (MyListItem* )(( const CEGUI::WindowEventArgs& )args ).window;
if ( item->isSelected() )
{
select(item->getID(), pk);
}