Programming with Decoration Controls
This topic describes how to complete the following tasks programmatically.
Creating a Decoration Control
Use NewCtrl to create a decoration control. The following example adds a decoration control around an existing set of controls.
int meterWidth, meterHeight, meterLeft, meterTop, numWidth, numHeight, numLeft, numTop;
GetCtrlBoundingRect (panelHandle, PANEL_NUMERICMETER, &meterTop, &meterLeft, &meterHeight, &meterWidth);
GetCtrlBoundingRect (panelHandle, PANEL_NUMERIC, &numTop, &numLeft, &numHeight, &numWidth);
decCtrl = NewCtrl (panelHandle, CTRL_RECESSED_BOX_LS, "", (meterTop - 5), (meterLeft - 5));
SetCtrlAttribute (panelHandle, decCtrl, ATTR_WIDTH, (meterWidth + numWidth + 10));
SetCtrlAttribute (panelHandle, decCtrl, ATTR_HEIGHT, (meterHeight + 10));
SetCtrlAttribute (panelHandle, decCtrl, ATTR_ZPLANE_POSITION, 5);
Controlling the Z-Plane Position
You can ensure the decoration control appears behind all other controls by obtaining the total number of controls on the panel and positioning the decoration control.
int numCtrls;
GetPanelAttribute (panelHandle, ATTR_NUM_CTRLS, &numCtrls);
SetCtrlAttribute (panelHandle, decCtrl, ATTR_ZPLANE_POSITION, numCtrls);