Previous chapterNext chapter Show allShow all    Hide allHide all

The parameter dispElement contains the interface for the dynamic element. With this element the linked zenon variable determined. If it is valid, the range of the slider is set. Additionally the settings for the display (number of ticks, …) are set. If no variable is linked, the display range is set to 0 to 0. So the SliderCtrl cannot be operated. The variable m_bInitialized defines that values can be set from now on.

BOOL CCD_SliderCtrlCtrl::zenOnInit(LPDISPATCH dispElement)


//*** Determine the variable using the zenon element

m_interfaceElement = IElement(pElementInterface);

if (m_interfaceElement.GetCountVariable() > 0) {

short nIndex = 0;

m_interfaceVariable = IVariable




//*** Initialize the area of the Slider-Ctrl

if (m_interfaceVariable) {

//*** Define range

m_nRangeStart = (long) VariantToDouble(&m_interfaceVariable.GetRangeMin());

m_nRangeEnd = (long) VariantToDouble(&m_interfaceVariable.GetRangeMax());


//*** Define sub ticks




} else {


return FALSE;



m_bInitialized = TRUE;

return TRUE;