"insertItemId"
Inserts a new item at runtime.
Synopsis
setValue(string shape, "insertItemId", string parentId, int type, int position,
string id, string text);
shape.insertItemId(string parentId, int type, int position, string id, string
text);
Parameters
Parameter | Description |
---|---|
shape | Name of the graphics object |
parentID | Name of the item where the entry will be added as a popup. With an empty string "", the entry will be added at the highest level. |
type |
CB_ITEM = 0 for item CB_POPUP = 1 for popup CB_SEPARATOR = 2 for separator |
position | Number of position. -1 means the bottom. |
id | Identity of the entry |
text | Text of the new entry |
Description
You can extend or complete a cascade at runtime with a script. The entry can be an item or a popup. Furthermore, you can add a separator to optically separate the entries.
Example
Create a cascade with two entries with one item below the popup with the id p1. Furthermore, create three text fields tf, tf2 and tf3. In the text field tf define the type, in tf2 the id and your text will be edited in tf3. A forth text field executes with an EventCommand (return click) the following script (in the example the position is -1 being the bottom position).
main()
{
string pId, id, text;
int typ;
pId = this.text;
typ = tf.text;
id = tf2.text;
text = tf3.text;
CascadeButton1.insertItemId((pId,typ,-1,id, text);
}
Open your panel in Vision and edit 0 in tf for a new item, edit "my id"; in tf2 for the id and edit "my item"; in tf3 for your text. If you click the return key in the text field with the script, the script is executed and adds a new entry "my item" at the bottom. Delete all entries of the text fields and edit "2" in tf to create a separator, the cascade has a separator at the bottom. Try different possibilities of editing the text fields.
Assignment
Cascade