company logo

ControlContext :: property - Get property handle

The function returns property handle that acts as data source for the control. In case of trees or multiple region lists, the data source originally assigned to the control is returned. In order to get the region property handle for the currently selected item, currentProperty() or Line ( context ).property() should be called.

In case of user-defined data sources, controls may (temporarily) not refer to a data source. When no data source is available for the control, the function throws an exception. In order to avoid exceptions, one may call hasData() before calling property() .

In case of combo-boxes, the property handle returned depends on the state of the control. When list items are filled or updated, the property handle for the list will be returned ( doAfterDataSet() , doBeforeDataSet() handler). Otherwise, the function returns the property handle for the combo box data source.

In order to change the data source for a control, one may call setProperty() . Since the function has a number of side effects it is not implemented as setter function for the property.

{ // fragment 1

  Property   ph(property()); // creates a copy

  ...

  DoWhatsNecessary(ph);

  ...

}

{ // fragment 2

  Property   &ph = property(); // refers to original property handle

  bool             started = false;

  ...

  started = ph->startRTA();

  DoWhatsNecessary(*ph);

  ph->stopRTA(started);

  ...

}

Notes:

When changing data or selection in the property handle, this may result in visible changes in the control, since data events from the property handle are passed to the control. In order to avoid changes in the user interface while acting on the property handle, a copy of the handle should be created. When the application should reflect the final settings after finishing the action, one may also call odaba:: ObjectSpace ::startReadTransaction() , which will cache and optimize property events until odaba:: ObjectSpace ::stopReadTransaction() is called.

Return value:  Propery handle ( odaba::Property & )

Implementation details

odaba::Property & ControlContext  :: property (  )