GetDialogProperty - working properly?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
tbrahmer
Newbie
Posts: 15
Joined: Thu May 06, 2010 10:14 pm

GetDialogProperty - working properly?

Post by tbrahmer » Sat Jul 03, 2010 9:30 pm

Playing with new v12 dialogs and tried a few things.
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

Works fine. But I can't seem to use GetDialogProperty for the dialog itself.
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

User avatar
Marcus Tettmar
Site Admin
Posts: 7393
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Jul 05, 2010 10:24 am

I can confirm that GetDialogProperty is not retrieving properties for the dialog as it should be - only for child components. We already have this fixed in dev so it will be fixed in the next maintenance release.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts