GUIListBoxCtrl Order *Solved
by Adam Griffiths · in Torque Game Builder · 03/31/2008 (2:23 am) · 2 replies
Hello all,
A quick query. I've got a high score implementation working within my game and by using the GUIListBoxCtrl i've been able to produce this list on the screen. However, whichever way i try to list the scores, they always come out in ascending order rather than a High Score table would logically appear; with the Highest at the top.
There doesn't seem to be any kind of detail listed for using this Control so I can't see how to reverse the list properly. Has anyone used one of these before or have a clue what I could do?
I'm tempted to read all the Player names and Scores into variables and displaying them in TextBoxes but it's not very dynamic and I wanted it to be as dynamic as possible!
Thanks in advance!
**EDIT**
Solved my own problem but thought i'd leave it on here for anybody else who may be having problems.
The List Box Control sorts by Alphabetical order. So for names its A to Z, numbers are 0 to 9. Therefore if you have scores of say 80, 120, 230 the list will sort to appear as 120, 230, 80.
ListBox.sort(0); sorts by the first column
ListBox.sort(1); sorts by the second column
etc etc
By way around this, I stored a rank for each object along with its corresponding playerName and playerScore. I then sorted by rank meaning 1 was at the top going downwards to 5 at the bottom.
A quick query. I've got a high score implementation working within my game and by using the GUIListBoxCtrl i've been able to produce this list on the screen. However, whichever way i try to list the scores, they always come out in ascending order rather than a High Score table would logically appear; with the Highest at the top.
There doesn't seem to be any kind of detail listed for using this Control so I can't see how to reverse the list properly. Has anyone used one of these before or have a clue what I could do?
I'm tempted to read all the Player names and Scores into variables and displaying them in TextBoxes but it's not very dynamic and I wanted it to be as dynamic as possible!
Thanks in advance!
**EDIT**
Solved my own problem but thought i'd leave it on here for anybody else who may be having problems.
The List Box Control sorts by Alphabetical order. So for names its A to Z, numbers are 0 to 9. Therefore if you have scores of say 80, 120, 230 the list will sort to appear as 120, 230, 80.
ListBox.sort(0); sorts by the first column
ListBox.sort(1); sorts by the second column
etc etc
By way around this, I stored a rank for each object along with its corresponding playerName and playerScore. I then sorted by rank meaning 1 was at the top going downwards to 5 at the bottom.
Torque Owner Ehrlich