"ensureItemVisible"

The attribute "ensureItemVisible" ensures that an item is visible, scrolling the list view vertically if necessary and opening (expanding) any parent items if this is required to show the item.

Synopsis

shape.ensureItemVisible(string Id [, string Position]);

Parameters

Parameter Description
shape Name of the object
Id Element Id.
Position

Position of the visible element

possible values:

EnsureVisible Default value, ensures that the element is visible.
PositionAtTop Scrolls to position the element at the top of the widget
PositionAtBottom Scrolls to position the element at the bottom of the widget
PositionAtCenter Scrolls to position the element at the center of the widget

Description

The attribute "ensureItemVisible" ensures that an item is visible, scrolling the list view vertically if necessary and opening (expanding) any parent items if this is required to show the item. The optional parameter "Position" defines where the visible element will be positioned.

Example

In the following example the "ensureItemVisible" is used to ensure that the element "Part12" is shown. Several elements are added first so that the "Part12" would normally not be visible.

main()
{
  TREE1.addColumn("MOTOR");
  TREE1.appendItem("","MOTOR","MOTOR");
  TREE1.appendItem("MOTOR","Part4","Part4");
  TREE1.appendItem("MOTOR","Part5","Part5");
  TREE1.appendItem("MOTOR","Part6","Part6");
  TREE1.appendItem("MOTOR","Part7","Part7");
  TREE1.appendItem("MOTOR","Part8","Part8");
  TREE1.appendItem("MOTOR","Part9","Part9");
  TREE1.appendItem("MOTOR","Part10","Part10");
  TREE1.appendItem("MOTOR","Part11","Part11");
  TREE1.appendItem("TEIL11","Part12","Part12");
  TREE1.ensureItemVisible("TEIL12");
}

Example

In this example, the element "Part12" is scrolled to be at the bottom of the widget.

main()
{
  TREE1.ensureItemVisible("Part12", "PositionAtBottom");
}

Assignment

Tree widget