Dialog Label width property not maintained

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

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

Dialog Label width property not maintained

Post by Jerry Thomas » Wed Feb 16, 2011 5:25 pm

I am trying to set a label width to the width of the dialog and then let Alignment take care of centering.

When I save the Dialog Editor and update the script, everything looks good. But when I run the script or reopen the Dialog Editor, the width is lost and the label goes to minimum needed to show the label (in this case 30).

Bug or am I doing something wrong?

Note lblTitle width = 429

Code: Select all

Dialog>Dialog1
object Dialog1: TForm
  Left = 373
  Top = 198
  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 = []
  OldCreateOrder = True
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object lblTitle: TLabel
    Left = 1
    Top = 32
    Width = 429
    Height = 13
    Alignment = taCenter
    Caption = 'TITLE'
  end
  object Edit1: TEdit
    Left = 1
    Top = 72
    Width = 429
    Height = 21
    TabOrder = 1
    Text = 'Edit1'
  end
end
EndDialog>Dialog1

GetDialogProperty>Dialog1,lblTitle,Width,TitleWidth
SetDialogProperty>Dialog1,Edit1,Text,%TitleWidth%

Show>Dialog1,
Thanks,
Jerry

[email protected]

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

Post by Marcus Tettmar » Thu Feb 17, 2011 11:50 am

You need to set the AutoSize property of the label to FALSE. Otherwise the width you set is overridden and the label is autosized to fit the content.
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
cron
Sign up to our newsletter for free automation tips, tricks & discounts