User Tools

Site Tools


18.5 Expander

This component is a container whose surface can be animatedly expanded and collapsed.

To select the Expander container in the IDE, you must click on the inner (highlighted) part in the container or select the Expander container in the hierarchy view.

18.5.1 Expander properties

You control the display of the contents of an expander component via the Expander.Hidden property. Other properties of an expander are described in the following table:

ExpanderData typeDefaultDescription
.AnimatedBooleanFalseDetermines or sets whether the expander is animated when it is expanded and collapsed.
.HiddenBooleanFalseDetermines or sets whether the expander content is hidden or not.
.TextString-Sets or returns the text to be displayed over the expander area.
.TextFontFont-Sets or returns the TextFont for the identifier above the expander area.

Table Expander properties

18.5.2 Events Expander

The number of events of the Expander component is kept within narrow limits - there are only two:

  • Hide - This event is fired after the expander hides its contents.
  • Show - This event is triggered just before the expander displays its content.

18.5.3 Example Expander

The temperature measurement project presented uses the Expander component. It takes up the configuration of the RS232 interface. By clicking on the identifier 'Configuration RS232 (USB adapter) interface' or on the symbols or you can show or hide this configuration. By using the class gb.settings you determine whether the programme interface should be displayed minimised or maximised when the programme is started.


Figure GUI temperature measurement with hidden configuration

The source code is given only in the passages that presents the use of the Expander component. The complete project can be found in → 16.13 ComboBox.

[1] Public v24Settings As New Settings(User.Home &/ "V24T" &/ "v24T.conf")
[3] Public Sub Form_Open()
[5]   FMain.Center
[6]   FMain.Resizable = False
[8]   FMain.Height = 180
[9] ' expRX_TX.Hidden = True ' Option ohne gb.settings
[10]   expRX_TX.Animated = True
[11] ...
[12]   expRX_TX.Hidden = v24Settings["Expander/ExpanderHiddenStatus", "TRUE"]
[14] End
[17] Public Sub expRX_TX_Hide()
[18]   FMain.Height = 180
[19]   expRX_TX.Hidden = True
[20] End
[22] Public Sub expRX_TX_Show()
[23]   FMain.Height = 448
[24]   expRX_TX.Hidden = False
[25] End
[27] Public Sub Form_Close()
[28]   ...
[29]   v24Settings["Expander/ExpanderHiddenStatus"] = expRX_TX.Hidden
[30]   ...
[31] End

When the programme is first started, it is displayed in minimised size → line 12 because the default value for the hidden status is True. Hiding and displaying the contents of the Expander component is always linked to a corresponding change in the size of the programme interface, as shown by the 2 procedures in lines 17 and 22. When the programme interface is closed → line 29, the current (hidden) status of the expander is saved in the configuration file v24T.conf and set as the start value for a further programme call.

The height of the form can also be adjusted automatically. For this, FMain.AutoResize = True and FMain.Arrangement = Arrange.Vertical are set in the source code of the GUI. It is only important that Form.Arrangement is set to an appropriate value! The assignments in lines [18] and [23] for the form height are then superfluous. The Hidden property is always set to the correct value internally by the class.


Figure GUI temperature measurement with unfolded expander




The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k18/k18.5/start.txt · Last modified: 07.10.2023 by emma

Page Tools