CEGUI listbox


21-11-2007 21:03:33

I am trying to set up a listbox in CEGUI using python-ogre, The box itself will display fine if I comment out the last 6 lines of this code - as soon as I start adding items to the box my application crashes when it tries to render the first frame, I set each items AutoDelete to false and added them to an array so they are not removed by python but it still crashes on me. Any help is appreciated!

def initGUI(app):
## setup GUI system
app.GUIRenderer = CEGUI.OgreCEGUIRenderer(app.renderWindow, ogre.RENDER_QUEUE_OVERLAY, False, 3000, app.sceneManager)

app.GUIsystem = CEGUI.System(app.GUIRenderer)

logger = CEGUI.Logger.getSingleton()
level = CEGUI.Informative

## load scheme and set up defaults
app.GUIsystem.setDefaultMouseCursor("TaharezLook", "MouseArrow")
app.GUIsystem.setDefaultFont( "BlueHighway-12")

sheet = CEGUI.WindowManager.getSingleton().loadWindowLayout("meshSelectionBox.xml")

meshSelectionBox = CEGUI.WindowManager.getSingleton().getWindow("Root/")

meshList = os.listdir("../resources/models")

i = 0
for mesh in meshList:
item = CEGUI.ListboxTextItem(mesh, i)
item.AutoDeleted = False


22-11-2007 03:11:56

Is it your meshSelectionBox that's being deleted (there's nothing wrong with your insert code)

Perhaps make it an app.meshSelectionBox ??



23-11-2007 11:28:43

You can try Andy's suggestion, but i don't think that's the problem. The box will get deleted, but the contents are still in CEGUI. It seems that you have found a workaroud for the item crash, but you are free to test with my code to see if it makes a difference.

A helper function:

# Some colours
ListItemColour = CEGUI.colour(1,1,1)
ListItemSelectedColour = CEGUI.colour(0,5,0.5,0.5)
ListItems = [] # Hack to avoid weird crashes
# Generic gui list modifier
def AddListItem(aGUIList, aString, anID):
item = CEGUI.ListboxTextItem(aString, anID)
# Save to avoid crash
# Change to your own imageset, if any
item.setSelectionBrushImage("WindowsLook", "Background");

And change your item loop to this:

i = 0
for mesh in meshList:
AddListItem(meshSelectionBox, mesh, i)



31-12-2007 16:12:43

I took a break from this issue and focused on a few other things, but now i am to a point in my application where I really need to get CEGUI working, i am still having the same issues. Also i have noticed that the included python-ogre cegui demos do not work on my machine, they all crash with errors similar to one of the following

File "C:\PythonOgre\demos\cegui\Demo_CEGUI_NewGui.py", line 195, in _createScene
st = winMgr.createWindow("TaharezLook/StaticText", "TextWindow/Static")
RuntimeError: WindowManager::getWindow - A Window object with the name 'extWindow/Static

File "C:\PythonOgre\demos\cegui\Demo_CEGUI_Facial.py", line 141, in _createGUI
sheet = cegui.WindowManager.getSingleton().loadWindowLayout("facial.layout")
RuntimeError: GUILayout_xmlHandler::startElement - layout loading has been aborted since no WindowFactory is available for 'TaharezLook/StaticText' objects.

I have tried re-installing python-ogre but that didn't help. Also, the CEGUI demos in regular Ogre work fine, not sure if that makes a difference or not.
any help is appreciated! i'm getting desperate on this one!


02-01-2008 20:09:31

I have narrowed my problem down to this line, if I comment it out the program no longer crashes, the listbox shows up, however there is no text in it.


EDIT: This is the last line inside of my CEGUI.log file, and I am assuming this is what is causing the error.

02/01/2008 15:41:09 (InfL1) Attempting to create Imageset 'BlueHighway-10_auto_glyph_images_ ' with texture only.


10-12-2012 20:27:55

i realize this is a dead thread but since i had this problem and found the thread on google, i thought id let google know about the solution.
You need to maintain the listboxitem reference outside of listbox to prevent the crash.