company logo

GUIBaseContext :: doBeforeDataSet - Pre-event handler for fill line data

The handler is called before a line in a tree or list is going to be filled (DEV_BeforeDataSet event). The handler is called for each item in the list, but also for static lines. The selected item is available in the current property handle (property()).

When updating items for a list of a combo-box, the function returns the property handle for the list rather than the property handle for the combo box data source.

The handler allows filtering items in a list. In order to filter items, selection must be set for the control (setFilter(true)) in the open handler (doAfterOpen()). For accepting an item, the handler should return 0. In order to reject items the function returns 1. Static lines cannot be rejected. In order to determine, whether the current line is a static line or not, one may call the Line::type() function.

The handler should return one of the following values:

  • -1 (not handled) - the event handler will be removed from the handler list and is not called anymore.
  • 1 (refuse) - Currently selected instance is rejected.
  • 0 (ok) - Currently selected instance is accepted.

int8 cPersonTree :: DoBeforeDataSet ( ) {

  Property    &p = currentProperty();

  return ( p.integer("age") < 18 ? 1 : 0);

}

Implementation details

int32 GUIBaseContext  :: doBeforeDataSet (  )