1

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);
}
AdriRomas
  • 201
  • 3
  • 9
  • Just a hint: you will never have CAN message value available on start(). It is merely waking u at that point, so it will never know any kind of actual CAN message. You have an on message handle on your selected message, right? – VioletVynil Dec 22 '18 at 13:09
  • Hi. Yes, the code above is to make it unconditional and non dependent on the arrival of a message. Just for testing purposes. Once the code above is working I have to link it to the arrival of the specific message instead of the on start event. – AdriRomas Jan 03 '19 at 09:27
  • setControlProperty("ObjectsPanel","Point1","Location","150, 200"); should work. Are you sure there is no space somewhere in ObjectsPanel name ? Try another function like SetControlVisibility() to see if the namings are correct. Also make sure the panel you are reffering to is linked to the cfg (or by checking the filelist of listed elements of the cfg, or checking the Panels... menu. – VioletVynil Jan 03 '19 at 10:10

1 Answers1

1

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.

AdriRomas
  • 201
  • 3
  • 9