company logo

GUIBaseContext :: doAfterDataSet - Line fill data post-event handler

The handler is called after a line in a tree or list has been filled (DEV_AfterDataSet event). The handler allows setting line decorations or text colors. The property handle for the currently selected instance can be provided by calling line().property(). In some cases, the collection referenced by the property is located, but not selected. In order to access property instance data, the property has to be read (see example below).

The function is also called for static lines in trees. In this case, no instance is selected in the property handle. In order to determine, whether the current line is a static line or not, one may call line().type().

When an error occurred during reading the instance, the property handle may not be located anymore. Nevertheless, the handler will be called. In order to avoid exceptions, the property handle state should be checked in the handler.

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.

... myControlContext::doAfterDataSet() { // osi fragment

  set< VOID > &data;

  Layout       lo = line().layout();

  if ( line().type() == LineTypes::Data ) { // process data lines, oly

    data &= line().property();

    if ( !data.located() )             // property handle has to be located

      LEAVE;

    if ( !data.selected() )          // data has not yet been read

      if ( !data.tryGet() )

        LEAVE;                       // Leave in case of read error

    // select proper line font in line (layout)

    line().setLayout(layout);

  }

}

Implementation details

int32 GUIBaseContext  :: doAfterDataSet (  )