What I want is for user to make a selection from a list box.
If selection = a
.Panel A visible = True
.Panel B visible = False
If selection = b
.Panel A visible = False . . (Collapsed so Panel B is directly under Listbox)
.Panel B visible = True
I know I could change 'Top' to move the panels, but I am hoping there is an easier way without having to keep up with the height of the different panels. (There will be 8-10 panels)
Code: Select all
Dialog>Test
object Test: TForm
Left = 669
Top = 186
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'CustomDialog'
ClientHeight = 608
ClientWidth = 431
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object Panel1: TPanel
Left = 29
Top = 128
Width = 185
Height = 65
Caption = 'Panel A'
TabOrder = 0
object Label1: TLabel
Left = 8
Top = 8
Width = 32
Height = 13
Caption = 'Label1'
end
end
object MSListBox1: tMSListBox
Left = 30
Top = 8
Width = 121
Height = 97
ItemHeight = 13
TabOrder = 1
SelectedIndex = -1
end
object Edit1: TEdit
Left = 211
Top = 42
Width = 121
Height = 21
TabOrder = 2
Text = 'Make Selection...'
end
object Panel2: TPanel
Left = 34
Top = 211
Width = 185
Height = 70
Caption = 'Panel B'
TabOrder = 3
object Label2: TLabel
Left = 16
Top = 16
Width = 32
Height = 13
Caption = 'Label2'
end
end
end
EndDialog>Test
AddDialogHandler>Test,MSListBox1,OnClick,DoClick
Let>items=a%CRLF%b%CRLF%both
SetDialogProperty>Test,MSListBox1,Text,items
Show>Test,r
SRT>DoClick
GetDialogProperty>Test,MSListBox1,SelectedItems,SelectedItem
SetDialogProperty>Test,Edit1,Text,SelectedItem
If>SelectedItem=a
SetDialogProperty>Test,Panel1,Height,70
SetDialogProperty>Test,Panel1,Visible,True
SetDialogProperty>Test,Panel2,Height,0
SetDialogProperty>Test,Panel2,Visible,False
Else
If>SelectedItem=b
SetDialogProperty>Test,Panel1,Height,0
SetDialogProperty>Test,Panel1,Visible,False
SetDialogProperty>Test,Panel2,Height,70
SetDialogProperty>Test,Panel2,Visible,True
Else
SetDialogProperty>Test,Panel1,Height,70
SetDialogProperty>Test,Panel1,Visible,True
SetDialogProperty>Test,Panel2,Height,70
SetDialogProperty>Test,Panel2,Visible,True
Endif
Endif
END>DoClick