PDA

View Full Version : Dialog Box with Buttons


dorkauf89
11-25-2007, 09:05 AM
I made a setup and at the end I want it to ask them if they want to restart their computer now or later. I want to do this by having a dialog box that says something like "Sorry, but you have to restart your computer" and then there will be two buttons, "restart now" and "restart later". How do I do this? I know how to do that they have a dialog box that says something with only one button and when they press it, it restarts their computer. How do I do two buttons? HELP! Thank you in advance.:)

pww
11-26-2007, 02:01 PM
most simple would be with a message box that asks '.... do you want to restart now?' and has Yes and No buttons.

In case you need custom buttons text, modify some of the available screens.
Add a new screen in the "After Installing" section, or simply modify the "Finished Install" screen , I think it's added by default - uncheck 'Visible' for the Cancel button, and change texts of Back and Finish buttons to Restart Now & Restart Later. Then edit the action associated with the Restart Now button.

dorkauf89
11-26-2007, 02:43 PM
Thank you very much but, how to I write the script so I tell it that if they press the yes button, it will restart? do I put:

if buttoname then
....
end

????

I don't think so... How do I do it?

pww
11-26-2007, 03:11 PM
for a message box, sort of this


q = Dialog.Message("Reboot now?", "Do you want to reboot now?", MB_YESNO, MB_ICONQUESTION, MB_DEFBUTTON2);
if q == IDYES then
--reboot
System.Reboot();
else
--quit
Application.Exit();
end;


You may put this code in the On Next script of your last screen, or simply remove After Installing screen(s) and put it in the On Post Install script

dorkauf89
11-26-2007, 03:32 PM
What if I want to use radio buttons? I added a screen with radio buttons one says restart now and the other one says restart later. How do I tell him what to do for different buttons? How do I give them names? Thanks!

pww
11-27-2007, 03:00 PM
then put this in the On Next script


uChoice = String.ToNumber(SessionVar.Expand("%RadioSelection%"));
if uChoice == CTRL_RADIO_BUTTON_01 then
--if the first option is selected, reboot
--assumes the first radio button is 'Reboot now', second is 'Reboot later'
System.Reboot();
else
--otherwise quit
Application.Exit();
end;

dorkauf89
11-27-2007, 03:13 PM
Thank you very much! I'm kind of new to this business so sorry for the stupid questions! Thanks