Old 21st February 2007, 13:32   #1
n0On3
Senior Member
 
n0On3's Avatar
 
Join Date: Jan 2001
Location: Barcelona
Posts: 314
Send a message via ICQ to n0On3
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?
n0On3 is offline   Reply With Quote
Old 21st February 2007, 16:03   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
I wonder, are you referring to NSIS installer?

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 21st February 2007, 16:14   #3
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
http://nsis.sourceforge.net/ButtonEvent_plug-in

-Stu
Afrow UK is offline   Reply With Quote
Old 21st February 2007, 20:42   #4
n0On3
Senior Member
 
n0On3's Avatar
 
Join Date: Jan 2001
Location: Barcelona
Posts: 314
Send a message via ICQ to n0On3
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:
code:
Function MyGUIInit
# Create event handler for our parent window button.
ButtonEvent::AddEventHandler /NOUNLOAD 3
FunctionEnd



and then I put this other code as a function when the page is left.
code:
Function ComponentsLeave
# Find out if one of our buttons was just pressed.
ButtonEvent::WhichButtonID /NOUNLOAD
Pop $R0 # Control ID of button user pressed.


and that's all, then the greyed button should do what the function ComponentsLeave says, did I understood correctly?
n0On3 is offline   Reply With Quote
Old 21st February 2007, 22:56   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 25th February 2007, 16:36   #6
n0On3
Senior Member
 
n0On3's Avatar
 
Join Date: Jan 2001
Location: Barcelona
Posts: 314
Send a message via ICQ to n0On3
this is the code I used with the previous functions:

code:
Page InstFiles "EnterInstall" "" "ExitFunction"


the problem is that the ExitFunction is loaded before the user can even click on a button.

Remember that I am trying to activate the buttons on the final page of the installer, which I couldn't find a page name for it, and hence I used "InstFiles".
n0On3 is offline   Reply With Quote
Old 13th January 2011, 15:21   #7
n0On3
Senior Member
 
n0On3's Avatar
 
Join Date: Jan 2001
Location: Barcelona
Posts: 314
Send a message via ICQ to n0On3
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
n0On3 is offline   Reply With Quote
Old 18th January 2011, 16:44   #8
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Why are you calling ExitFunction on page leave? Try not calling it.

Stu
Afrow UK is offline   Reply With Quote
Old 18th January 2011, 16:57   #9
n0On3
Senior Member
 
n0On3's Avatar
 
Join Date: Jan 2001
Location: Barcelona
Posts: 314
Send a message via ICQ to n0On3
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?
n0On3 is offline   Reply With Quote
Old 18th January 2011, 17:05   #10
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 18th January 2011, 17:23   #11
n0On3
Senior Member
 
n0On3's Avatar
 
Join Date: Jan 2001
Location: Barcelona
Posts: 314
Send a message via ICQ to n0On3
Quote:
Originally Posted by Afrow UK View Post
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).
Ok, 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.

Next.

What does it mean to "use ButtonEvent on both" which both? I don't understand what "both" are you refering to. Also, how to use ButtonEvent on them? Do you mean both buttons? The close button and the one I am interested?

I am using the default UI. So, what I have is this page with the leave function and the grey button I want to use.

code:
Page InstFiles "EnterInstall" "" "ExitFunction"


I am trying to read the examples, but I get lost easily.

So, what I have to do is activate the grey button and put the ButtonEvent code somewhere so I can compare $R0 on the leave function and if it's 3 then use the code I want for that button.

Now, if you can help me a little bit further... thanks
n0On3 is offline   Reply With Quote
Old 18th January 2011, 23:14   #12
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 19th January 2011, 00:06   #13
n0On3
Senior Member
 
n0On3's Avatar
 
Join Date: Jan 2001
Location: Barcelona
Posts: 314
Send a message via ICQ to n0On3
how can I use a callback on the grey button? I still don't know how to make that button active.
n0On3 is offline   Reply With Quote
Old 19th January 2011, 10:14   #14
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 21st January 2011, 12:48   #15
n0On3
Senior Member
 
n0On3's Avatar
 
Join Date: Jan 2001
Location: Barcelona
Posts: 314
Send a message via ICQ to n0On3
Ok, I am finally seeing the light



I made this function to see which button is pressed at the end:

code:
Function `.onInstSuccess`
ButtonEvent::WhichButtonId
Pop $R0
MessageBox MB_OK "$R0"
FunctionEnd



But I can't get the "back" button to be active when the installer has finished. This code makes it active while installing, but it turns grey again when it's finished.


code:
Function `obrir`
GetDlgItem $0 $HWNDPARENT 3
EnableWindow $0 1
FunctionEnd



This function is called in the instfiles page:

code:
Page InstFiles `` `obrir` ``
n0On3 is offline   Reply With Quote
Old 21st January 2011, 15:40   #16
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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

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
Afrow UK is offline   Reply With Quote
Old 25th January 2011, 22:25   #17
n0On3
Senior Member
 
n0On3's Avatar
 
Join Date: Jan 2001
Location: Barcelona
Posts: 314
Send a message via ICQ to n0On3
Quote:
Originally Posted by Afrow UK View Post
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
Correct 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 am not using "SomeOtherPage".
n0On3 is offline   Reply With Quote
Old 23rd January 2011, 23:06   #18
n0On3
Senior Member
 
n0On3's Avatar
 
Join Date: Jan 2001
Location: Barcelona
Posts: 314
Send a message via ICQ to n0On3
ok, thanks for trying. I'll see what I can do.
n0On3 is offline   Reply With Quote
Old 26th January 2011, 16:50   #19
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 29th January 2011, 11:41   #20
n0On3
Senior Member
 
n0On3's Avatar
 
Join Date: Jan 2001
Location: Barcelona
Posts: 314
Send a message via ICQ to n0On3
ok thanks. I see how this goes.
n0On3 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump