Source language: Translate to:

ListBoxAddItem problems

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

ListBoxAddItem problems

Postby Kevin McGinley » Fri Jul 28, 2006 1:24 pm

I am using the AddItem command to, obviously, add items to a combo box. In test mode, it adds the item but then, as you would expect, the item disappears when you run the pub in design mode the next time. The problem I am having is that the added items won't stick in the compiled pub either. When I open the compiled pub after having added an item, added items which had appeared when I added them or not there after closing and opening the compiled pub. They should stick, right? I am simply using the code:

ListBoxAddItem "ComboBox1" "1" "[textentry1]"

if I want to know that the item is in the first slot (i use the comboboxes sometimes to store vital program info like a pathway) or "0" to simply add it to the list (most of the listed are sorted alphabetically).

Any clues?

Kevin
Kevin McGinley
 
Posts: 5
Joined: Mon Jul 24, 2006 7:14 pm

Postby Sam Cox » Fri Jul 28, 2006 1:43 pm

Misconception!

ListBoxAddItem adds an item to the run-time copy of a listbox/combox, but it does not save the augmented object to disk. Similarly, ListBoxDeleteItem does not permanently remove items, and ListBoxSort does not permanently change the object.

If you need the ability to permanently affect the content of a listbox or combox, you must save the contents to and restore them from an external file or, perhaps, the registry.
User avatar
Sam Cox
 
Posts: 768
Joined: Fri Apr 01, 2005 7:30 am
Location: Loveland CO USA

Postby cp4w » Sun Jul 30, 2006 2:43 pm

If you need the ability to permanently affect the content of a listbox or combox, you must save the contents to and restore them from an external file


Yes, I use ListBoxAddItem in my adventure game to list (add and remove) the objects of the player. When the player saves the game the content of the ListBox is saved in a text file and when the player loads a saved game, the content of the text file is inserted in the ListBox.

Bye
Licia

Greetings from Italy
cp4w
 
Posts: 533
Joined: Sun Apr 03, 2005 4:37 pm
Location: Great Neck, NY


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest