can-buscaplcanoecanalyzer

Set control Location property programatically with Capl script on Canalyzer


I have designed a panel using Vector Panel Designer so I can display it in CANAlyzer.

Now I am trying to set the location of a Picture Box control based on the value of a CAN signal.

I have tried several options but did not succeed. My panel is called "ObjectsPanel" and the Picture Box control is called "Point1". These are some of the options I have tested:

on start{
  setControlProperty("ObjectsPanel","Point1","X","150");
  setControlProperty("ObjectsPanel","Point1","X",150);
  setControlProperty("ObjectsPanel","Point1","Location","150, 200");
  setControlProperty("ObjectsPanel","Point1","Location.X",150);
}

Solution

  • It seems that SetControlProperty can only change the following properties of a control programatically: BackColor and ForeColor.

    Quote from CANalyzer documentation:

    The CAPL SetControlProperty routine is now only permissible for the BackColor and ForeColor properties of controls created with the Panel Designer. Please use the SetControlBackColor and SetControlForeColor routines in such cases. You can also use the following CAPL functions to modify and manage controls: SetMediaFile, SetPictureBoxImage, SetClockControlTime, ClockControlStart, ClockControlStop, ClockControlReset.