data from list box

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
circusdan
Posts: 32
Joined: Thu Jun 02, 2011 10:05 pm
Location: United States

Post by circusdan »

The final result is to have the game run at different speeds for different difficulties. There will be different lobbies that people can play in for each speeds. Right now I randomly create fake servers just for the sake of testing my sorting functions. In the first screenshot it is set on 1/3 time and there are 3 lobbies.
Image

Now when i switch it to 1/5 time, there are 4 lobbies operating in this speed, the data on the list box changes, however the combo box still shows that the time selected is 1/3 time

Image

Before I added the sorting functions the combo box worked fine, but when i implemented them it messed it all up, but i didnt really touch anything with the box
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

circusdan wrote: Now when i switch it to 1/5 time, there are 4 lobbies operating in this speed, the data on the list box changes, however the combo box still shows that the time selected is 1/3 time
Then you are very likely doing something with the combobox. You can test it very simple - just create a combobox with some data and _nothing else_. A very short program. I'm pretty certain it will work. So it means you do something that breaks it. So reduce your code until it works again. Find out when it starts working again and check the line that makes the difference.
circusdan wrote: Before I added the sorting functions the combo box worked fine, but when i implemented them it messed it all up, but i didnt really touch anything with the box
First time you mention some sorting functions at all ... if you want other peoples help please don't hide half of what you do and let us guess around and then throw in more info piece by piece. As it broke after you added those there is obviously a very big chance it has something to do with them, don't you think so?

Edit: Try the following - write a short program which we can compile and which exactly reproduces your bug. Remove everything else from your code and make sure it really compiles. Then you can post that and people can just check it out.
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
Reiko
Posts: 105
Joined: Sun Aug 16, 2009 7:06 am
Location: Australia

Post by Reiko »

judging by your code on the previous page, your pointer to the combo box is just called "box". however in only what you pasted, I can't notice any errors.

possibly, you copied+pasted some code somewhere else and forgot to rename something. or you wrote "box" somewhere thinking you were referring to the list box (though I can see its called "list"). and so, it is doing something to your combo box even though you didn't mean it to.

how are you creating the list/combo boxes? maybe its in your device->run() loop and so its creating a new one of each in the same place every single frame... and so the visibly selected one is always the first item in the list.
blAaarg
Posts: 94
Joined: Tue Mar 02, 2010 9:11 pm
Location: SoCal

Post by blAaarg »

I know this isn't your main problem or anything but...
The index is s32 data type. However, i could only use it in the function as an int.
I was curious as to what this meant and why you didn't check or post your compiler errors and warnings. I suspect it's because you're not using "irr::s32" or aren't placing "using namespace irr;" at the top of that file, but speaking more in general, you shouldn't skip over the part of debugging where you make sure to take advantage of the debugger's features. I don't know what IDE you're using but it would be definitely worth your while to look into that "80 percent" aspect of programming. :)

In any case, if using int works, it works. I'm just saying you--like every other programmer--are gonna run into a lot more bugs before you're done.:wink:
"Computers don't make mistakes! What they do they do on purpose!!"

-Dale Gribble
circusdan
Posts: 32
Joined: Thu Jun 02, 2011 10:05 pm
Location: United States

Post by circusdan »

I'm pretty new about all this and i have no idea what the s32 data type is about, all i know is it wouldnt work when i tried to make the function input that data type, but worked as an int. About the combo box, ive found a solution, it may not be the best but it worked. I couldn't find anywhere that it was messing up, so i took the value from the getSelected() function, and used it in setSelected() after i was done setting everything up. I know it's kind of a back door fix but it's all i could do
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

s32 is a signed integers with 32-bit size. Which is on nearly every platform identical to int and your problem has nothing to do with converting between those two - doing that is fine.

Using setSelected and getSelected in combination makes often sense. Without more info (as usual...) I can't tell more - but when it works it's probably fine :-)
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
Post Reply