Archive: Multiple choice messagebox?


Multiple choice messagebox?
Hi.

I'd like to have a messagebox that would have three choices. The user would choose between this that or the other option. The buttons could be called 1 2 and 3 (but it would be nice to be able to name them something else as well).

Could anyone give me an example of how to do this, if it's possible?


This can be done by using the Customisable MessageBox plug-in. An example is included with the contribution.


Thanks, I'll take a look at that. :)


Amazing... I came to the forums to search for this exact question. Without searching, it just happened to be the very first question in queue on the forums...

Thank you both, I needed this!


Bah... I have the IQ of a dead mule, so I need some help.

I've been reading the example.nsi and the readme, but I can't get through my thick skull how I'm supposed to use labels with this thing. I mean - if I have three buttons, I want it to work like: "click button 1 = goto label 1" "click button 2 = goto label2", and so on.

So how does this work?

Here's what I've got so far, but it doesn't work, obviously - the labels aren't used, so no matter what button I click, it goes to the first messagebox on the list. But it's as far as I've got (names changed etc.):


Section ""
messagebox::show MB_ICONEXCLAMATION "" "" "You are removing the Example.txt file. \
$\n$\nYou now have a couple of choices:$\n$\n1: Restore the Original Example1.txt file.$\n$\n2: \
Restore the even Older Example0.txt file.$\n$\n3: \
Extract the very Latest Example2.txt file.$\n" Original Older Latest
Original:
MessageBox MB_OK "Original text file restored."
Goto End
Older:
MessageBox MB_OK "Older text file restored."
Goto End
Latest:
MessageBox MB_OK "Latest text file extracted."
End:
SectionEnd

you can't use labels with the plugin but will need to do a comparison on the returned value ($0) and use that for deciding where the jump is made to. using logiclib's ${if} $else{} (i think they're correct) should help.

if you're keeping an eye on the plugin's main thread you'll see i'm trying to sort out issues with the plugin over the next few days to at least make it useable (i hope)

-daz


OK, thanks.

-But what am I doing wrong in the script now then? :

[edited] I had a question here, but now suddenly I got the script below to work! The only thing I had forgotten, was the Pop $0. I have now updated the script below, and it works!! :) [/edited]


Name "Customized MessageBox Test File"
OutFile "Customized MessageBox Test.exe"
!include "LogicLib.nsh"

Section ""
messagebox::show MB_ICONEXCLAMATION "" "" "You are removing the Example1.txt file. \
$\n$\nYou now have a couple of choices:$\n$\n1: Restore the Original Example.txt file.$\n$\n2: \
Restore the even Older Example0.txt file.$\n$\n3: \
Extract the very Latest Example2.txt file.$\n" "Original" "Older" "Latest"

Pop $0

${if} $0 == 1
MessageBox MB_OK "Original text file restored."
Goto End
${endif}

${if} $0 == 2
MessageBox MB_OK "Older text file restored."
Goto End
${endif}

${if} $0 == 3
MessageBox MB_OK "Latest text file extracted."
${endif}
End:
SectionEnd

that works fine for me :)

i'm thinking with the re-working to allow a given buffer/variable to be set as the default to be used by the plugin instead of hard coded to $0 (which would remain as the default) to possibly fix some of the stack usage issues it can cause (though i'd need to test out it's viability first)

-daz