Skip to content
Menu
Menu

Knowledge Base

KB050134 | DYNAMICALLY SHOW/HIDE CONTROLS AND CHANGE PROPERTIES

KB050134 | DYNAMICALLY SHOW/HIDE CONTROLS AND CHANGE PROPERTIES

Product: Elvis
Version: 2.x
Booth: 2006-09-04

Summary

This article presents a solution to the following problem:

A display is to be implemented that changes the font and background color of a control element (e.g. Analog Output) depending on the ActualValue of a data point. Likewise, the ActualValue of another data point is intended to show or hide the control element.

Details

For the example, an Elvis Analog Output Controls is used (can be linked to any data point). It’s very simple:

  1. Create the two control data points with the names “ON/OFF” (for color control) and “Visible/Invisible” (for visibility) of the type EIB switch.
  2. In the example, these two data points are each connected to a state button for testing, but of course the values can also come from the bus.
  3. Enter the following code in Form Load (“replace AnalogOutput” with the name of the control element to be influenced):
    //CODE:vb:' Farben setzen
    If Database.Datapoint("Ein/Aus").ActualValue = True Then
    	Form.Item("AnalogOutput").Forecolor = 255
    	Form.Item("AnalogOutput").Backcolor = 655336
    Else
    	Form.Item("AnalogOutput").Forecolor = 655336
    	Form.Item("AnalogOutput").Backcolor = 255
    End If
    ' Sichtbarkeit setzen
    Form.Item("AnalogOutput").Visible = Database.Datapoint("Sichtbar/Unsichtbar").ActualValue  //CODE
  4. In the Form DatapointChanged, type the following code:
    //CODE:vb:If Dp.Name = "Ein/Aus" And prop = "ActualValue" Then
    	' Farben setzen
    	If DP.ActualValue = True Then
    		Form.Item("AnalogOutput").Forecolor = 255
    		Form.Item("AnalogOutput").Backcolor = 655336
    	Else
    		Form.Item("AnalogOutput").Forecolor = 655336
    		Form.Item("AnalogOutput").Backcolor = 255
    	End If
    End If
    If Dp.Name = "Sichtbar/Unsichtbar" And prop = "ActualValue" Then
    	' Sichtbarkeit ändern
    	Form.Item("AnalogOutput").Visible = DP.ActualValue
    	' Bedienseite neu zeichnen
    	Form.Document.Redraw
    End If//CODE

You have to handle both events so that the correct display is ensured at the beginning (Form_Load) and also after each relevant data point change.

Download the sample project kb050134.zip.

Support Area

KB050134 | DYNAMICALLY SHOW/HIDE CONTROLS AND CHANGE PROPERTIES

Knowledge Base

Here you will find answers, solutions to problems and examples of our products.
KB050134 | DYNAMICALLY SHOW/HIDE CONTROLS AND CHANGE PROPERTIES

Case Studies

Successful in use: practical examples of our products and individual developments.
KB050134 | DYNAMICALLY SHOW/HIDE CONTROLS AND CHANGE PROPERTIES

Support

Describe your concern using our support form.
KB050134 | DYNAMICALLY SHOW/HIDE CONTROLS AND CHANGE PROPERTIES

License registration

Register your Elvis license!

IT GmbH · An der Kaufleite 12 · D-90562 Kalchreuth

© Copyright 2024. IT GmbH | Webdesign by Appear Online