SUBJECT: Stringlists
BY: DAN ALDER (Corel)
Date: 9 February 2001
A Quick Stringlist Demo
- Create a new string list (file | new | stringlist, or right-click the icon or toolbar and select new...); add some strings, save.
- Open a form, or create a new one.
- in the form's stringListFileName property, enter the name of the string list you just created. *THIS FILE MUST EXIST*, it won't let you enter
the name if it doesnt. Pathnames are valid, as are aliases. If nothing is specified, :work: is assumed.
- drop a text object on the form. Cancel the expert if necessary, and enter some text (so you can see the object).
- In the object's stringID field, enter a number that corresponds to a string in the string list. The text object should change to reflect the string
from the file.
That's pretty much it.
A few quick notes:
- the default extension for stringlists is .pxr (stands for ParadoX Resource). Chosen because it doesn't conflict with any other known
extension.
- you can change the stringListFileName property in the init event (ie, init fires before the stringlist is read.)
- changing the stringlistFileName property through ObjectPAL will allow you to change the string list (currently it automatically re-loads the
list; this shouldn't happen unless there's an explicit call to form.stringListRefresh() -
QA: can we make sure there's a bug logged on this?)
- in ObjectPAL, you can attach to the form's string list (which will likely be the most common use) by declaring a stringlist variable and calling
stl.attach().
- use pxr.getString() to retrieve a string from a stringlist.
Right there, you've got 90% of the usefulness of stringlists.
From: PAUL CRONK
It would be helpful that the ObjectExplorer would append .pxr to the filename if the extension is not supplied.
When you save the string list in the File Save dialog you don't have to appended the file extension. It is appended automatically.
Make sure the file actually exists first, and that it's either in the working directory or you're telling it where to look.