0

I'm using a Switch/Indicator Panel element in CANalyzer for visualising some system states with an image. I would like to change the path from where the Switch/Indicator gets this image by means of a CAPL program configured inside a Program Node in a Mesaurement Setup. So, are there a way to change a property like "image path" of a Switch/Indicator Panel element from CAPL?

framontb
  • 1,817
  • 1
  • 15
  • 33

2 Answers2

1

There is a PictureBox element in the CANalyzer Panel whose file path can be loaded in measurement time with the SetPictureBoxImage() CAPL Panel function. The advantage of doing so (PictureBox instead Switch/Indicator element Panel) been that if you need to represent a very large number of states (N), the Switch/Indicator method will need a unique very large image file (maybe not manageable), whereas the PictureBox will need N little images.

framontb
  • 1,817
  • 1
  • 15
  • 33
1

"Switch/Indicator" has property "Image". To change it from CAPL in runtime:

setControlProperty("Panel name", "Switch/Indicator name", "Image", "c:\1.bmp");
  • It is not working for me. Could be because of my CANalyzer version 8? – framontb Nov 05 '18 at 08:34
  • In the Write window, it appears a warning: "System 19-0001 Invalid SetControlProperty (Property = Image) CAPL call for a control element belonging to a panel created with the Panel Designer. The call will be ignored." It seems that this property can't be modified by this command (at least in Version 8). The documentation says: "The CAPL SetControlProperty routine is now only permissible for the BackColor and ForeColor properties of control elements created with the Panel Designer. Please use the SetControlBackColor and SetControlForeColor routines in such cases." – framontb Nov 05 '18 at 09:54
  • 1
    My bad. It works for property"Text" of "Static Text" control. Tried for "Switch/Indicator" and it not works. Also the property is called "ImageFile". But no errors in write window. – Anton Salnikov Nov 06 '18 at 12:41