Hello,
I am trying to display certain signals that are visible in the Receive/Transmit tab in a Text Box like object on the Instrument Panel. The signal should only be displayed if it has a certain value.
Is this possible with the existing features?
Thanks!
Display CAN Signals on Instrument Panel
- PEAK-Support
- Sales & Support
- Posts: 1646
- Joined: Fri 10. Sep 2010, 19:34
Re: Display CAN Signals on Instrument Panel
at the moment you could not hide/show a control via script. This is a feature that comes only in the PCAN-Explorer 6 Version within the next weeks. You could try to set the x/y position depending on the signal to a negative value, so that the control is out off the view if the signal is not valid. Problem is, that you also do not see the control in Design mode! A second solution could be the using of the scene feature - but this enable / disable always a complete panel.
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
Re: Display CAN Signals on Instrument Panel
Thank you for your reply Mr. Wilhelm,U.Wilhelm wrote:at the moment you could not hide/show a control via script. This is a feature that comes only in the PCAN-Explorer 6 Version within the next weeks. You could try to set the x/y position depending on the signal to a negative value, so that the control is out off the view if the signal is not valid. Problem is, that you also do not see the control in Design mode! A second solution could be the using of the scene feature - but this enable / disable always a complete panel.
Could you please tell me how a Received Signal Value can be used to move a Control?
And what are the steps for the scene feature be used?
- PEAK-Support
- Sales & Support
- Posts: 1646
- Joined: Fri 10. Sep 2010, 19:34
Re: Display CAN Signals on Instrument Panel
Here a simple code sample how to get the reference to a Label on a panel:
later on in the code, you could use the reference to set properties while your script is running:
So you could move the object (in this case a label) to any place on your panel you like. See my sample screen. (animated GIF) If you use negative positions, the control is not visible anymore. (be carefull! if you stop the macro, and the position is not visible, you could not "find" the control on the panel..)
How to work with different scene is part of the online help. It is also well documented.
Code: Select all
Dim PanelDoc, panel, scene, label, i
Set PanelDoc = Documents.Open("Panel1.ipf")
If Not PanelDoc Is Nothing Then
Set panel = PanelDoc.ActiveWindow.Object
Set scene = PanelDoc.ActiveWindow.Object.ActiveScene
For i = 1 to scene.Controls.Count
If scene.Controls.Item(i).Name = "myLabel" Then
Set label = scene.Controls.Item(i)
End If
Next
End If
Code: Select all
' Create the sinus signal
x = 0
Do While StopSig.Value = 0
x = x + .05
SinusSig.Value = Sin(x) * 50
label.Left = SinusSig.Value + 260
label.Top = SinusSig.Value + 50
label.Caption = SinusSig.Value
Wait 50
Loop
How to work with different scene is part of the online help. It is also well documented.
- Attachments
-
- 2017-05-24_16-46-40.gif (875.75 KiB) Viewed 6707 times
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
Re: Display CAN Signals on Instrument Panel
Thank You!