Beijer Electronics (formerly QSI Corporation)

Can string arrays be used in Qlarity?
Page 1 of 1

Author:  Ron L. [ Fri Mar 03, 2006 10:24 am ]
Post subject:  Can string arrays be used in Qlarity?


Can string arrays be used in Qlarity? Does Qlarity have support for multi-dimensional arrays? Is there a work around?


The Qlarity language does not have multi-dimensional arrays. We have a couple of ways of working around this.

One method is to use an array of integers indexing a large string to mimic a string array. We have functions built into Qlarity to manipulate and read strings from the 2 arrays such as _GetString, _AppendString, _DeleteString, _FindString, _GetStrCount, _RedimStrArray, _RemoveLastString and _SetString (see F1 help in Qlarity Foundry).

Another method of storing an array of strings (or any array) is to use an array of array handles. With this you put the array in memory and keep track of a reference to this memory location called an array handle. It is easy to cause a memory leak with lost array handles so you must keep track of all allocated array handles and be sure to free them. The functions for this are: AllocateArrayHandle, FreeArrayHandle, and ReadArrayHandle (see F1 help).

You could also create a pool of objects and use an array of object references to access your objects. The objects could have array variables in them. Lets say for example you wanted to create an array of labels. First in layout view you create 50 instances of labels with the names labe_1 to label_50. To put references to these objects into an array you can use code simliar to this:

'in globals

library basic source labelv2

dim labelrefs[50] as objref labelv2

func Startup ()

    handles MSG_INIT

    dim i as integer

    for i = 1 to 50

        val(labelrefs[i-1], "label_" + str(i))




Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group