I tried to fix a nagging problem I was facing with the column width not working for all users (the width was sometime to wide or too narrow). I was told that the column widths are not accessible through the dialog handler commands. But this software being what it is, the most versatile SW there is, I came up with a solution for my problem using WriteLn and Include.
Here's the idea exemplified. I hope more users will benefit from this.
You need to save the script for it to work.
Code: Select all
//LabelToVar doesnt have to contain a full dialog code LabelToVar>DialogCode,TEMP IncludeFromVar>TEMP //I delete it if it exists just to show that it is in fact dynamic IfFileExists>%SCRIPT_DIR%\dialog.scp DeleteFile>%SCRIPT_DIR%\dialog.scp Endif> //Since I'm using label to variable there cannot be a dialog1 existing in two places in the script file.. this string replace is just a workaround for that StringReplace>TEMP,DialogX,Dialog1,TEMP GoSub>RANDOMIZE_AND_REPLACE_STUFF //Write the dialog script file WriteLn>%SCRIPT_DIR%\dialog.scp,,TEMP //Include it (if you compile as exe you shouldn't compile includes) Include>%SCRIPT_DIR%\dialog.scp //Show the dynamic dialog Show>Dialog1,r SRT>RANDOMIZE_AND_REPLACE_STUFF Random>100,RANDOM_LEFT Random>100,RANDOM_TOP StringReplace>TEMP,[RANDOM_LEFT],%RANDOM_LEFT%,TEMP StringReplace>TEMP,[RANDOM_TOP],%RANDOM_TOP%,TEMP StringReplace>TEMP,[USER_NAME],%USER_NAME%,TEMP END>RANDOMIZE_AND_REPLACE_STUFF /* DialogCode: Dialog>DialogX object DialogX: TForm Left = 247 Top = 97 HelpContext = 5000 BorderIcons = [biSystemMenu] Caption = 'TEMP' ClientHeight = 211 ClientWidth = 476 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 Label1: TLabel Left = [RANDOM_LEFT] Top = [RANDOM_TOP] Width = 32 Height = 13 Caption = '[USER_NAME]' end end EndDialog>DialogX */