activate greyed buttons at final screen
There are three buttons at the final screen (Exit, Options, Close), two of them greyed (Exit and Options), how could I activate them and write a function for them?
Archive: activate greyed buttons at final screen
activate greyed buttons at final screen
There are three buttons at the final screen (Exit, Options, Close), two of them greyed (Exit and Options), how could I activate them and write a function for them?
I wonder, are you referring to NSIS installer?
lol, yes I am talking about NSIS :)
Afrow UK, let's see if you can help me a bit, because the example in that plugin is too complex for me.
3 is the control id of the greyed button "Options", I put this code as a function that loads the page where the button is:
Function MyGUIInit
# Create event handler for our parent window button.
ButtonEvent::AddEventHandler /NOUNLOAD 3
FunctionEnd
Function ComponentsLeave
# Find out if one of our buttons was just pressed.
ButtonEvent::WhichButtonID /NOUNLOAD
Pop $R0 # Control ID of button user pressed.
I found a bit of old text in the readme about the /PARENT parameter which is no longer needed... if you want to grab the Zip again at http://nsis.sf.net/File:ButtonEvent.zip
Yes that code is correct, but I wouldn't recommend using the back button though (because it belongs to the installer), but try it anyway it should still work.
$R0 in your leave function will be 3 if your button is pressed or -1 otherwise. A simple StrCmp (or ${If}) will allow you to execute NSIS code accordingly.
-Stu
this is the code I used with the previous functions:
Page InstFiles "EnterInstall" "" "ExitFunction"
ok, after almost four years, I attempt to do it again :P
is it possible to make clickable the button which in this screenshot is called "enrera"?
http://www.flickr.com/photos/mai9/5184179946/
because I am not sure if what the plugin ButtonEvent is made for this purpose.
Thanks
Why are you calling ExitFunction on page leave? Try not calling it.
Stu
I was trying to use it because on Feb 22 you said:
$R0 in your leave function will be 3 if your button is pressed or -1 otherwise. A simple StrCmp (or ${If}) will allow you to execute NSIS code accordingly.
I have one other question, if I want to use the button called "enrera" in the screenshot, do I have to reshack edit the UI?
Ah I see. You could try using ButtonEvent on both. Why do you need to edit the UI? If the button is already there you just need to enable it and show it (if it is hidden).
Stu
Originally posted by Afrow UKOk, great, no need to edit the UI. I read it in the readme and I was wondering if I should still have to edit it.
Ah I see. You could try using ButtonEvent on both. Why do you need to edit the UI? If the button is already there you just need to enable it and show it (if it is hidden).
Page InstFiles "EnterInstall" "" "ExitFunction"
Yes try on both buttons. I understand what you are trying to do by using a leave function but you don't have to do it that way. You can just use callbacks on each button instead via ButtonEvent.
Stu
how can I use a callback on the grey button? I still don't know how to make that button active.
Get the correct control id and use that (it will be 1, 2 or 3). To make it active use EnableWindow and if necessary ShowWindow.
Stu
Ok, I am finally seeing the light :)
I made this function to see which button is pressed at the end:
Function `.onInstSuccess`
ButtonEvent::WhichButtonId
Pop $R0
MessageBox MB_OK "$R0"
FunctionEnd
Function `obrir`
GetDlgItem $0 $HWNDPARENT 3
EnableWindow $0 1
FunctionEnd
Page InstFiles `` `obrir` ``
I have tried and all I can suggest is you add another button (i.e. ID of 4) over the top of the Back button with Resource Hacker and only show it on the InstFiles page. For the previous and next pages you will need to hide the button again (add a Show functions for both).
I.e.
Page Components HideMyBackButton
Page InstFiles ShowMyBackButton
Page SomeOtherPage HideMyBackButton
Function HideMyBackButton
GetDlgItem $0 $HWNDPARENT 4
ShowWindow $0 ${SW_HIDE} ; WinMessages.nsh
FunctionEnd
Function ShowMyBackButton
GetDlgItem $0 $HWNDPARENT 4
ShowWindow $0 ${SW_SHOW} ; WinMessages.nsh
FunctionEnd
Stu
ok, thanks for trying. I'll see what I can do.
Originally posted by Afrow UKCorrect me if I am wrong, but with this code the "MyBackButton" is showed at the beginning of the install, not at the end (when the close button activates)
I have tried and all I can suggest is you add another button (i.e. ID of 4) over the top of the Back button with Resource Hacker and only show it on the InstFiles page. For the previous and next pages you will need to hide the button again (add a Show functions for both).
I.e.[code]Page Components HideMyBackButton
Page InstFiles ShowMyBackButton
Page SomeOtherPage HideMyBackButton
If you need that behaviour then you will have to enable the button in your last section (or add another section at the end specially). As for adding in the last page, well that was just for an example.
Stu
ok thanks. I see how this goes.