Using the 'Dialogs - Simple Modal' sample script included with MS as follows:
Code: Select all
Dialog>Dialog1
object Dialog1: TForm
Left = 666
Top = 271
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'Simple Modal Dialog'
ClientHeight = 140
ClientWidth = 340
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
Position = poDesigned
ShowHint = True
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 24
Top = 16
Width = 80
Height = 13
Caption = 'Enter your name:'
end
object Edit1: TEdit
Left = 21
Top = 37
Width = 284
Height = 21
TabOrder = 8
Text = 'Edit1'
end
object btnOK: tMSButton
Left = 24
Top = 88
Width = 75
Height = 25
Caption = 'OK'
Default = True
DoubleBuffered = True
ModalResult = 10
ParentDoubleBuffered = False
TabOrder = 9
DoBrowse = False
BrowseStyle = fbOpen
end
object btnCancel: tMSButton
Left = 112
Top = 88
Width = 75
Height = 25
Cancel = True
Caption = 'Cancel'
DoubleBuffered = True
ModalResult = 2
ParentDoubleBuffered = False
TabOrder = 10
DoBrowse = False
BrowseStyle = fbOpen
end
end
EndDialog>Dialog1
Show>Dialog1,r
If>r=10
GetDialogProperty>Dialog1,Edit1,Text,strName
MessageModal>Your name is: %strName%
Endif
If>r=2
MessageModal>Dialog was cancelled
Endif
Documentation says 'To access properties of the dialog itself leave ObjectName blank' so I tried:
GetDialogProperty>Dialog1,,Caption,strName
GetDialogProperty>Dialog1,,ShowHint,strName
GetDialogProperty>Dialog1,,Font.Name,strName
...etc. I just keep getting %strName% returned - no matter what property I am trying to get. Am I doing this wrong?
Another thing I noticed, don't know that it matters much to most of us, but:
With other objects, everything seems to return exactly what is in the dialog block except when I ask for the 'TabOrder' property - that comes back differently - It looks like those get changed at runtime. For instance, the 'Dialog' block shows 8,9,10 TabOrder for Edit1, btnOK, btnCancel...
Using GetDialogProperty, it returns 0,1,2 respectively. That is the right TabOrder on the runtime dialog, but if anyone had any need to alter those it would be nice if the code block and runtime values matched. Just an FYI.
Thanks