Source language: Translate to:

listbox sort problem

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

listbox sort problem

Postby William Sabin » Thu Jul 20, 2006 8:54 pm

I have a listbox listbox1 with a variable [listbox1] In the general properties of the list box I have [Listbox1]

I load the list box from a file text.txt , the data loads fine. I have a button with the action sort listbox1 When I press the button, the list box doesnot sort, but is cleared all entries. If I replace the variable [Listbox1] with the numbers in the text.txt file, the list box sorts correctly. Any idea what I am doing wrong.
William Sabin
User avatar
William Sabin
 
Posts: 7
Joined: Sat Apr 02, 2005 7:28 pm
Location: Lester, WV

Postby Wrangler » Fri Jul 21, 2006 7:17 am

Hard to tell without seeing some of your code. Can you post what you've got?
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1507
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby William Sabin » Fri Jul 21, 2006 10:23 am

Hi Wrangler,

The code is very simple here it is. Along with an explination of what is going on. Have one list box and one button. and a load a file called test.txt upon page entry.

Listbox1
Object name is Listbox is listbox1
variable name is [Listbox1]
listed items shows [Listbox1]
Variable contains item Text is checked
state: visable enabled

Button has as caption [Listbox1]
..Actions:
ListBoxSort "ListBox1" "True"

..Page properties Actions

FileRead "[PubDir]Test.txt" "All" "[ListBox1]"

..on page entry the debugger shows
..Actions
ListBoxSort "ListBox1" "True"
..Variables
listbox1
...Data is correct and the data correctly loaded into
...the variable [listbox1] Data is shown in listbox1
...and on the button caption.

...When I press the button, the debugger shows
ListBoxSort "ListBox1" "True"
...Variables, the debugger does not show variable [Listbox1]
The listbox is blank and so is the button caption.

If I replace the variable [listbox1] from the listed items
on the listbox and replace with the actual number the sortworks correctly.

I am using 5.51 updated 12 July 2006
William Sabin
User avatar
William Sabin
 
Posts: 7
Joined: Sat Apr 02, 2005 7:28 pm
Location: Lester, WV

Postby William Sabin » Fri Jul 21, 2006 10:34 am

I figured it out.
If I load my text file to variable [X] and place [X] in the listbox listed items it works.
William Sabin
User avatar
William Sabin
 
Posts: 7
Joined: Sat Apr 02, 2005 7:28 pm
Location: Lester, WV

Postby Wrangler » Fri Jul 21, 2006 10:35 am

Do you have anything in the List Items box in the listbox properties? Since you are populating the box with a text file, it should be empty.

Have you tried not using the listboxsort action, and just checking the box "List alphabetically"? or is it necessary to turn the sort on and off elsewhere in the pub?
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1507
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby William Sabin » Fri Jul 21, 2006 4:59 pm

I have in the list box properties:

List Items [x]
variable [listbox1]
objectname listbox1
variable content item Text

I seems that I cannot use the variable name [listbox1] with the listbox sort. Some how it clears the list box.
It is not a problem as I can load my data from my file into variable [x]

With [x] in the list items, all is well.

If I leave the listbox items blank, nothing appears in the list box, however the data loads into the variable.

I decided to reload V5 again with the update just in case I got a bad load. It did not make any difference.
William Sabin
User avatar
William Sabin
 
Posts: 7
Joined: Sat Apr 02, 2005 7:28 pm
Location: Lester, WV

Postby Wrangler » Fri Jul 21, 2006 5:05 pm

Try this:

FileLen "sample.txt" "[FLen]"
Loop "1" "[FLen]" "[X]"
FileRead "sample.txt" "[X]" "[Name[X]]"
EndLoop

ListBoxDeleteItem "ComboBoxname" "all"

../ Process array
Loop "1" "[FLen]" "[X]"
ListBoxAddItem "ComboBoxname" "0" "[name[x]]"
EndLoop

This will work. :)
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1507
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA


Return to NeoBook Action Commands

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron