cObject
---cUIObject
------DfBaseObject
---------DfBaseWindow
------------DfBaseUIWindow
---------------DfBaseControl
------------------cTagsForm
---------------------cDbTagsForm
The cTagsForm is a Form-like control that allows for selecting of multiple items from a source (which can be a table or anything else) or even creating new items. The selected or created items are visually represented by boxes/balloons called tags.
The cDbTagsForm class extends the cTagsForm class by adding data-awareness.
Selection is done by typing text into the form and, optionally, a list of items to select from is displayed. See cSelectionSource for information on how this list can be controlled and seeded. Without a cSelectionSource configured, it can still be used to show and edit tags using free text entry (if pbAllowCreate is True).
Items are presented by a comma-separated list of strings or as an array of strings. This is a simplification regarding the previous implementations. The control does not keep extra data for the items. Only CSS classes can be set for the items, but this happens through separate APIs. Another simplification is that when filling the control, it does not check if items are actually part of the selection set, that is considered application logic.
The code below shows the most basic instantiation of the cTagsForm and what it will display. Notice that psValue can be set to a comma-separated list of tags.
Object oTagsFormBasic is a cTagsForm Set piColumnSpan to 12 Set psLabel to "Tags:" Set psValue to "DataFlex, CSS, SQL" End_Object
By default, new tags can be created by typing and pressing enter. This performs no database operations whatsoever, but it will display a popup indicating that a new item will be created when Enter is pressed.
Values can be queried by using psValue, which always returns a comma-separated list of values, and updating can be done via a Set of psValue.
Get psValue of oTagsFormBasic to sVal Move (sVal + ", Police Car") to sVal Set psValue of oTagsFormBasic to sVal
Commas in values are escaped using the backslash - \. So when the user types a , (comma) it will be presented in the value as \,. When the user types a \ (backslash) it will be escaped as \\.
As an alternative to working with the raw comma-separated list, two simple methods are available to get the tags as a string array and update them from a string array. The methods (GetTags and UpdateTags) internally just Get and Set psValue. They also take care of escaping / unescaping the items.
String[] aTags Get GetTags of oTagsFormBasic to aTags Move "Police Car" to aTags[SizeOfArray(aTags)] Send UpdateTags of oTagsFormBasic aTags