How to use a variable to select a picture in a dialog?

Got a problem you cannot solve? Try here.
Christoph Schneegans
Posts: 55
Joined: Tue Jan 09, 2007 12:20 pm

How to use a variable to select a picture in a dialog?

Postby Christoph Schneegans » Tue Jan 09, 2007 12:34 pm

I'd like to display a different picture in a dialog if a certain (compiler) variable is set. Is it possible to achieve this? Or do I have to recreate the entire dialog and use script code such as

if Variable MyVar Equals TRUE
Display Dialog: dialog1
else
Display Dialog: dialog2
end

to display the dialog that shows the proper picture?

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Wed Jan 10, 2007 5:29 pm

What you can do is place both pictures on the dialog, place an additional text field on the dialog and hide it, then set that text field's caption property to, for example, $FLAG$.

Now, in MSIcode, use Set Variable to pre-define FLAG to either TRUE or FALSE (just example values). Do this before showing the dialog.

And, back in the Dialog Editor, you can use Dialog Rules to show one of the pictures and hide the other when the value of the text field's caption (to which you assigned FLAG) is TRUE, and vice-versa. So no need to include two separate dialogs.
Michael Nesmith
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/

Christoph Schneegans
Posts: 55
Joined: Tue Jan 09, 2007 12:20 pm

Postby Christoph Schneegans » Thu Jan 11, 2007 4:26 am

Works like a charm. Thanks a lot!

mmiron
Posts: 19
Joined: Fri May 25, 2007 2:02 pm

Postby mmiron » Wed Aug 01, 2007 9:52 am

What if we didn't want to or couldn't embed the images; so therefore we really wanted to specify the image via the command line at compile time?


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 98 guests