How do you set Dialog height programatically?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

How do you set Dialog height programatically?

Post by Jerry Thomas » Tue Dec 07, 2010 10:24 pm

Is it possible to set a dialog height in code?

I can't get any of the Dialog properties to work. The objects in the dialog are no problem, its just the dialog itself.

The property that seems like it should work is 'ClientHeight'.
Is there another option or am I not specifying correctly?

Code: Select all

Dialog>Test2
object Test2: TForm
  Left = 524
  Top = 188
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'CustomDialog'
  ClientHeight = 212
  ClientWidth = 431
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  Height = 500
  OldCreateOrder = True
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 144
    Top = 104
    Width = 32
    Height = 13
    Caption = 'Label1'
  end
end
EndDialog>Test2

GetDialogProperty>Test2,Test2,ClientHeight,ht
SetDialogProperty>Test2,Label1,Caption,Height=%ht%

Show>Test2,r
Thanks,
Jerry

[email protected]

sarver311
Pro Scripter
Posts: 84
Joined: Tue Jun 17, 2008 6:37 pm

Post by sarver311 » Tue Dec 07, 2010 10:35 pm

Hey Jerry,

This should work for you.

Code: Select all

//This would retrieve the current height of the dialog
GetDialogProperty>Test2,,ClientHeight,ht

//This would set the height to 500
let>ht=500
SetDialogProperty>Test2,,clientheight,ht
Anytime you want to make a change to the Dialog using setdialogproperty you leave the parameter after the Dialogname blank.

Hope this helps.

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Post by Jerry Thomas » Tue Dec 07, 2010 10:52 pm

DOH!

Thanks!
Thanks,
Jerry

[email protected]

sarver311
Pro Scripter
Posts: 84
Joined: Tue Jun 17, 2008 6:37 pm

Post by sarver311 » Tue Dec 07, 2010 10:55 pm

Np, you were really close! :)

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