sLayout List VariableThe global variable sLayout is of type TListBox; and will reference the contents of the Layout form's list box in Ensign Windows.TListBox is a type with the following functions and properties, briefly mentioned here, but more fully documented in the ESPL Help documentation:
Clear empties the
list Example code to illustrate: var b.Add('JunkJunk'); sLayout.ItemIndex := 2; {select
3rd item on list} In the first few lines, I illustrate writing the contents of the Layout list
box to the Output window using sLayout. In the last section, I illustrate how an item in the list can be selected, and its layout executed with Double Click. One item is confusing, so I am making this effort to document it for you. sLayout is type TListBox so that it matches the Layout list box we use in Ensign Windows to hold the list in the layout form. Since TListBox objects have an Items object, we can work with sLayout.Items. Items is an object of type TStrings, so we can work with Items.Strings[] and Items.Count. Now for the quirk, to reference an item in the list, normally one should be able to use sLayout.Items.Strings[] However, this will give an error message because the ESPL compiler cannot compile a double dot reference. I call it a double dot reference because you had to use two dots or periods to write sLayout.Items.Strings[] The work around is to break the full reference into parts, as illustrated in the example script. sLayout.Items is of type TStrings, so I declared a variable of type TStrings and assigned it to point to sLayout.Items. Then, the compiler can reference the properties of the Items object. Example: b:=sLayout.Items; writeln(b.count); {this will compile} writeln(sLayout.Items.count); {equivalent to the above, but it will not compile because of the double dot reference} I will not expose the ability to create variables of type TListBox, because the functionality hoped for is already present in TStringList type variables |