Don't understand v12 Dialogs

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
gummybear
Newbie
Posts: 4
Joined: Mon Apr 26, 2010 1:55 pm

Don't understand v12 Dialogs

Post by gummybear » Fri Sep 09, 2011 3:38 pm

I liked the v11 dialogs, except it didn't support GIF files so I'm trying v12 to make it work.

So here's the problem. I want to make a dialog fullscreen. In v11, I just GetScreenRes>x,y and set the Dialog height = y and width = x. In v12, this doesn't work. None of the variables work. I can't even use %SCRIPT_DIR%

In order to set anything to a variable, I'd have to SetDialogProperty ?? Seems ridiculous just to set default settings. What's the whole point in defining the dialog if you have to do extra SetDialogProperties just to get it work?

Also I can't get the Left and Top attributes to work.
object Dialog1: TForm
Left = 0
Top = 0

Just creates a Dialog that appears in random locations, never 0,0.

User avatar
JRL
Automation Wizard
Posts: 3518
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Sep 12, 2011 5:51 pm

gummybear wrote:I liked the v11 dialogs, except it didn't support GIF files so I'm trying v12 to make it work.
What made you think version 12 dialogs support gif files?
Help for Dialog Objects wrote:LoadImage
Loads an image from file. Specify the filename of the picture to display (can be bitmap, jpeg, png, ico). Note that the image data is loaded statically into and stored in the dialog. To link dynamically assign a filename to LoadImage at runtime.
I wrote a test script just to be sure
SetDialogProperty>Dialog1,msimage1,LoadImage,%temp_dir%test.jpg
Works
SetDialogProperty>Dialog1,msimage1,LoadImage,%temp_dir%test.gif
Does not.

gummybear wrote:So here's the problem. I want to make a dialog fullscreen. In v11, I just GetScreenRes>x,y and set the Dialog height = y and width = x. In v12, this doesn't work. None of the variables work. I can't even use %SCRIPT_DIR%

In order to set anything to a variable, I'd have to SetDialogProperty ?? Seems ridiculous just to set default settings. What's the whole point in defining the dialog if you have to do extra SetDialogProperties just to get it work?
I agree, it would be handy to be able to set values via variables within the dialog block like we could in days of yore but that is no longer the case. You know what you need to do. Using SetDialogProperties is not really that big of an inconvenience. The extra functionality of the version 12 dialogs compared with previous versions makes it all worthwhile in my opinion.

For what its worth, for position and size, I find it simpler to use The MoveWindow> and ResizeWindow> functions rather than four lines of SetDialogProperties>. Be sure your give your dialog a unique name. Place them in the script anywhere between where the dialog block is defined and the Show>dialog line.
Last edited by JRL on Tue Sep 13, 2011 6:50 pm, edited 1 time in total.

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

Post by Marcus Tettmar » Tue Sep 13, 2011 6:03 pm

4 lines?

Only one is needed to make a window maximized (full screen if you prefer):

SetDialogProperty>Dialog1,,WindowState,wsMaximized
Show>Dialog1,r

Easier than v11.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

User avatar
JRL
Automation Wizard
Posts: 3518
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Tue Sep 13, 2011 6:49 pm

Yes four lines.

I was not addressing the full screen dialog aspect and perhaps should have quoted gummybear first.
gummybear wrote:Also I can't get the Left and Top attributes to work.
I have never been able to set the location of a v12 dialog by setting the Top and Left values inside the dialog block. I have had success using SetDialogProperties to set those same values. However, rather than using two lines of SetDialogProperties to set location I generally prefer to use MoveWindow and I can thus get the dialog to reside in the desired position using one line. And though setting the size in the dialog block by setting the values of ClientWidth and ClientHeight works (and is probably more accurate when you consider title bar and border width user modifications) using ResizeWindow usually works for me and is again one line rather than two.

Whether its four lines or two or ten shouldn't really matter. What really matters is that the version 12 style dialogs have greater flexibility. If you have the chance to learn to use them, do it. Well worth the time.

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