AMT Help Files

Layout Functions

The functions for layout controls containing lists of items, the Datagrid, Listview, Menu, Listbox and Combobox.

Function: Description: Applies to:
Columns.AddCheckbox

Adds a column of the type checkbox to the data grid.

Syntax:

<Control name>.Columns.AddCheckbox() 

Datagrid
Columns.AddEditbox

Adds a column of the type Editbox to the data grid.

Syntax:

<Control name>.Columns.AddEditbox() 

Datagrid
Columns.AddImage

Adds a column of the type Image to the data grid.

Syntax:

<Control name>.Columns.AddImage()

Datagrid
Columns.AddLabel

Adds a column of the type Label to the data grid.

Syntax:

<LabelColumn variable> := <Control name>.Columns.AddLabel(Type : <Type>, <Column name>, <Column caption>, <Column width>) 

Datagrid
<Type> The type of data this column can contain. Possible values are: Alpha, Boolean, Financial, Numeric, Signed or String.
In case of Alpha, Financial, Numeric and Signed, the length should be included. E.g. Numeric 8.2
<Column name>  The name of the column. 
<Column caption> The caption of the column which will be visible in the header of the Datagrid.
<Column width> The width of the column in pixels.
Example:

TotAmountCol := DATAGRID_1.Columns.AddLabel(Type : Financial 8.2, 'Col_Total', 'Total amount', 150)
 
Columns.Clear

Removes all the columns from the control, including any data held within.

Datagrid

Columns.Count

Returns the number of columns in the grid.

Syntax:

<Control name>.Columns.Count()

Listview, Datagrid

Items.Add *

Adds an item to the control.

Listview, Menu, Listbox, Combobox


 


 

Syntax for listviews and menus:

<Control name>.Items.Add()

Syntax for listboxes and comboboxes*:

<Control name>.Items.Add(<Value>, <Display text>)

 

<Value>

Alpha, String or Realstring value that must be sent to the Application server when an item is activated at runtime.

 

<Display text>

Alpha, String or Realstring value that is displayed when selecting an item in the layout control.

Items.Clear *

Deletes all items from the control.

Syntax:

<Control name>.Items.Clear

Listview, Menu, listbox, combobox

Items.Count

Returns the number of items in the control.

Syntax:

<Control name>.Items.Count()

Listview, Menu, Listbox, Combobox

Items.Delete *

 

Deletes the item that corresponds to the specified index number, including (possible) sub items. If the item is deleted successfully, resok will be set to "TRUE". Otherwise it will be set to "FALSE".

Syntax:

<Control name>.Items.Delete(<Item index number>)

Listview, Menu, Listbox, Combobox

<Item index number>

Index value (numeric without decimals) that indicates the record (item) to be deleted.

   

Items.IndexByName

 

Returns the menu item index that corresponds with the specified name. If there is no item with the specified name, then a zero (0) is returned.

Syntax:

<Control name>.Items.IndexByName(<Item name>)

Menu

<Item name>

Item name to be searched for.

   

Items.Insert

 

 

 

 

 

Inserts an item at the specified index row. If the item is added successfully, resok will be set to "TRUE". Otherwise it will be set to "FALSE".

Syntax for listviews:

<Control name>.Items.Insert(<Item index number>)

Syntax for listboxes and comboboxes*:

<Control name>.Items.insert(<Item index number>, <Value>, <Display text>)

Listview, listbox, combobox

<Item index number>

Index value (numeric without decimals) that indicates the row where the record (item) must be inserted.

<Value>

Value (Alpha, String or Realstring) to be sent when an end user chooses the record (item) corresponding with the <Item index number> at runtime.

<Display text>

Value (Alpha, String or Realstring) to be displayed in the record corresponding with the <Item index number> at runtime.

   

Items.Sort

Sorts the column that corresponds with the specified column number. The sort order can either be 'ASC' (ascending) or 'DSC' (descending). If the sorting is done successfully, resok will be set to "TRUE". Otherwise it will be set to "FALSE".

Multiple columns to sort on can be set. The order of precedence in sorting is the order of appearance in the parameter list.

Syntax:

<Control>.Items.Sort(<Order> <Column nr>[, <Order> <Column nr>[, ...]])

Note: For downwards compatibility the old single column sort syntax is also supported.

<Control>.Items.Sort(<Column nr>, <Order>)

Listview

Rows.Add

Adds a row to the datagrid.

Syntax:

<Control>.Rows.Add()

Datagrid
Rows.Clear

Clears all rows from the datagrid.

Syntax:

<Control>.Rows.Clear()

Datagrid
Rows.Delete

Deletes the row with the specified index number.

Syntax:

<Control>.Rows.Delete(<Row index number>)

Datagrid
<Row index number> The index number of the row which should be deleted. 
   
Rows.Insert

Inserts a new row at the specified index number.

Syntax:

<Control>.Rows.Insert(<Row index number>)

Datagrid
<Row index number> The index number where the row should be inserted. 
   

Save

With this function the file loaded into the 'File uploader' is uploaded to the target location as set in the <FilePath> property.

The <OverWrite> property will determine if existing files with the same names at the target location should be overwritten.

Syntax:

<Control>.Save(<FilePath>, <OverWrite>)

File uploader 
<FilePath>

The file path value with optional file name of the target destination for the uploaded file.

Allowed are relative paths by using .\ (dot backslash) to use the 'upload path' (as set in the control center Basepaths) as root.

A path without a file name will use the original file name of the uploaded file, optionally a new file name can be added to the file path to rename the uploaded file. When renaming files, the new file names must contain a file extension.

Absolute paths or UNC/network paths are not supported.

Examples:

// Saves the uploaded file to the basepath 'upload path' with the original file name. 
FileUploader_0.Save('.\', false)

// Saves the uploaded file to <upload path>\Uploaded\ renamed as Image.jpg.
FileUploader_0.Save('.\Uploaded\Image.jpg', true)

// Saves the uploaded file to <upload path>\<CCYYMMDD date>\ with the original file name.
Target :'.\' + Today.CCYYMMDD + '\' + FileUploader_0
FileUploader_0.Save(Target, true)
Please note that from AMT 93 onwards absolute paths are no longer allowed and of the selected file only the file name without a path is used.
<OverWrite>  Boolean value, if true any existing file with the same filename will be overwritten by the newly uploaded file.
If false, the existing file will be left intact.  

Series1.Add

Adds an entry to a chart. For a pie chart the add function must also specify the colour and legend values.

Chart

Series1.Clear

Clears all entries from the chart visual object.

Chart

SetFocus

Positions the cursor on the specified form field when the form is refreshed.

Editbox, Button group, Checkbox,
Listbox, Combobox, Calendar, File uploader, Datagrid


*) When using the ITEMS functions, one data-stream is sent directly from the data server to the client. This behavior differs from the standard functionality that was provided for the dynamic filling of listboxes and comboboxes with LION versions 5.2 and older. Because this difference in behavior, it is not possible to use the FILLBOX instruction in combination with one of the ITEMS functions for the same control item. The listbox and combobox property MemoryBased determines which functionality is supported.


If when using ITEMS functions the following error is displayed: "Can't resolve operand [ITEMS]", the property MemoryBased on the control is likely set to false. See also "Filling Listboxes and Comboboxes"