How to make this kind of window?
How to make this kind of window?
It is quite common to see such kind of window but when it comes to do programming to make it, it seems to be quite hard.
How can the program know if the user has selected an option and then it will generate the preview?
How to make the preview? Is it a scene node? or just a 2D picture?
-
- Posts: 226
- Joined: Wed Jan 26, 2011 5:37 pm
- Contact:
You catch the event (EGET_LISTBOX_CHANGED and EGET_LISTBOX_SELECTED_AGAIN for listboxes) in your eventreceiver and act on that. And previews are mostly 2d-images, although in RPG's for example you also often see real 3D models (probably using render-to-texture).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code: Select all
if (listBox->getListItem(listBox->getSelected()) == L"ABC")
Device->closeDevice();
So, if I select "ABC", the device should be closed but it is not the case....
Is there something wrong in the if statement?
In c++ you can't compare c-strings with ==. This will only check for identical pointers.
You have to either use a string class like core::stringw (probably easiest solution for you) or use the string-compare functions like wstrcmp.
So this should work probably:
You have to either use a string class like core::stringw (probably easiest solution for you) or use the string-compare functions like wstrcmp.
So this should work probably:
Code: Select all
if (stringw(listBox->getListItem(listBox->getSelected())) == stringw(L"ABC"))
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Or instead of converting to Irrlicht strings, you can use strncmp from the C standard library. It's designed to do string comparisons between C-style strings.CuteAlien wrote: So this should work probably:Code: Select all
if (stringw(listBox->getListItem(listBox->getSelected())) == stringw(L"ABC"))