SelectElements(Selection: IDimSelection; [Options: IDimConditionSelect]);
Selection. Element selection.
Options. Search options.
The SelectElements method generates an element selection meeting the conditions.
In the example the form contains the following components: UiDimension, DimensionTree, Button, EditBox. The OnClick event is described for the button.
Class UserForm: Form
uidim: UiDimension;
cmdSearch: Button;
tree: DimensionTree;
txtPattern: EditBox;
Sub cmdSearchOnClick(Sender: Object; Args: IMouseEventArgs);
Var
pMan : IDimOrmManager;
pClass : IDimOrmClass;
pCondition : IDimOrmCondition;
pCriteria : IDimTextCriteria;
pOptions : IDimConditionSelect;
Begin
pMan := New DimOrmManager.Create;
pClass := pMan.CreateClass(uidim.Dimension);
pCondition := pClass.CreateCondition;
pCriteria := New DimTextCriteria.Create;
pCriteria.CriteriaOptions := TextCriteriaOptions.FreeText Or TextCriteriaOptions.SearchStringAttributes;
pCriteria.Text := txtPattern.Text;
pCondition.SetTextCriteria(pCriteria);
pOptions := New DimTextCriteria.Create;
pOptions.SelectOptions := ConditionSelectOptions.SelectedOnly;
pCondition.SelectElements(tree.Selection, pOptions);
End Sub cmdSearchOnClick;
End Class UserForm;
Start the form and type in the text to be searched, next select desired elements in the tree and click the button; list selection changes: only the elements, string attributes of which contain the entered text, remain selected.
See also: