Old 19th May 2005, 00:08   #1
Alasdair
Junior Member
 
Join Date: May 2005
Location: England
Posts: 10
Controling hacked dialog buttons?

Hello,

I needed an extra button at the bottom of the setup screen (along with next, back, cancel) and so I used the resource hacker to add this button into the UI executable (is there a better way?) I gave the button ID 8888, which I assume is not being used.

This button now appears nicely on all pages of the setup program, but I need to do the following, and don't know how:

1. I only want the button to appear on certain pages of the setup program. Is there a way to make it invisible on the other pages?

2. I want the button to perform certain actions when pressed, and slightly different actions for different pages that it appears on. How to I go about implementing this?

Please help me out if you can. Thanks!
Alasdair is offline   Reply With Quote
Old 19th May 2005, 04:48   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,320
1 - Call ShowWindow in the show func for each page
2 - You will have to write a plugin that subclasses the main window

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 19th May 2005, 11:33   #3
Alasdair
Junior Member
 
Join Date: May 2005
Location: England
Posts: 10
Thanks, but could you please be a bit more specific? I'm new to NSIS and haven't done enough programming in regards to dialogs to know how they work.
Alasdair is offline   Reply With Quote
Old 19th May 2005, 12:19   #4
Aaron's rod
Junior Member
 
Join Date: Apr 2005
Location: Finland
Posts: 26
I don't think it's possible to do what you are trying without using InstallOptions plugin. You need it at lest to get the button actions.

However I am using "hacked" checkbox in my Self-Extractor thingy so that way I don't have to use InstallOptions plugin.

Use this code to hide and show the button.
code:
!include WinMessages.nsh

Page directory "" page_hide
Page instfiles "" page_show

Function page_function
Push $R0
Push $R1

FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R1 $R0 8888
ShowWindow $R1 ${SW_HIDE}

Pop $R1
Pop $R0
FunctionEnd

Function page_show
...
just as the page_hide but use ${SW_SHOW}




I am using this code to get the checkbox status.
code:
Page directory "" "" get_checkbs

Function get_checkbs
Push $R0
Push $R1

FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R1 $R0 1080
SendMessage $R1 0x00F0 0 0 $checkb_val

Pop $R1
Pop $R0
FunctionEnd


I am quite sure that this don't help you thou.
Because you can only use it to check control status between pages.
Aaron's rod is offline   Reply With Quote
Old 19th May 2005, 16:49   #5
Aaron's rod
Junior Member
 
Join Date: Apr 2005
Location: Finland
Posts: 26
Apparently that hide show script don't work if your button is in dialog 105, then you have to use function like this.
code:


!include WinMessages.nsh

Page directory "" page_hide

Function page_hide
Push $R0

GetDlgItem $R0 $HWNDPARENT 8888
ShowWindow $R0 ${SW_HIDE}

Pop $R0
FunctionEnd

Those previous functions only effect in current page's conrols.
Aaron's rod is offline   Reply With Quote
Old 19th May 2005, 17:30   #6
Alasdair
Junior Member
 
Join Date: May 2005
Location: England
Posts: 10
Okay, I've got the button displaying and hiding on the correct pages. But I'm using UltraModern UI (which is just an extension to Modern UI) and when I set pages using:
Page directory "" decline_hide
...the background of the page is grey instead of blue.

I tried the following but it gives an error:
Page MUI_PAGE_DIRECTORY "" decline_hide

Is there a different way of doing it on Modern/Ultramodern UI?

Thanks.
Alasdair is offline   Reply With Quote
Old 19th May 2005, 18:37   #7
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
!define MUI_PAGE_CUSTOMFUNCTION_SHOW showFunc
!insertmacro MUI_PAGE_DIRECTORY

-Stu
Afrow UK is offline   Reply With Quote
Old 19th May 2005, 20:20   #8
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,354
Send a message via ICQ to deguix
UltraModern UI? Never heard of this. Do you mean Experience UI which has blue pages?

My Wiki Pages

Working now on:
New projects. (language: any)
deguix is offline   Reply With Quote
Old 19th May 2005, 22:14   #9
Alasdair
Junior Member
 
Join Date: May 2005
Location: England
Posts: 10
No, UltraModern UI. It looks very nice:
http://guerin45.free.fr/UltraModernUI/

Thanks Afrow UK!
Alasdair is offline   Reply With Quote
Old 19th May 2005, 22:43   #10
Alasdair
Junior Member
 
Join Date: May 2005
Location: England
Posts: 10
Okay, I've got the buttons appearing on the right pages. Thanks with that!

I'm still stuck as to how to make the button do stuff when it's clicked. I want it to be able to do one of the following on different pages of the setup program:
1. Display a message box.
2. Set a variable and go to the next page.
Alasdair is offline   Reply With Quote
Old 20th May 2005, 04:22   #11
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,354
Send a message via ICQ to deguix
Did someone publish this UI here when it was released? I sincerely don't remember anything about this.

My Wiki Pages

Working now on:
New projects. (language: any)
deguix is offline   Reply With Quote
Old 20th May 2005, 11:42   #12
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Says it's made by SuperPat in docs.

-Stu
Afrow UK is offline   Reply With Quote
Old 20th May 2005, 12:06   #13
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Quote:
Originally posted by deguix
Did someone publish this UI here when it was released? I sincerely don't remember anything about this.
It was pusblished in the Winamp FR forums.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 20th May 2005, 14:25   #14
Alasdair
Junior Member
 
Join Date: May 2005
Location: England
Posts: 10
So does anyone know the answer to this:

--->>
Okay, I've got the buttons appearing on the right pages. Thanks with that!

I'm still stuck as to how to make the button do stuff when it's clicked. I want it to be able to do one of the following on different pages of the setup program:
1. Display a message box.
2. Set a variable and go to the next page.
<<---

Help me out if you can please. This is very important to me an I really have no idea!
Alasdair is offline   Reply With Quote
Old 20th May 2005, 15:16   #15
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
As Anders has already pointed out you have to write a plugin to do that. You have to assign a button to actually do something. This isn't possible with NSIS code on its own.

-Stu
Afrow UK is offline   Reply With Quote
Old 20th May 2005, 17:28   #16
Alasdair
Junior Member
 
Join Date: May 2005
Location: England
Posts: 10
Yeah, but I didn't really understand what he said. I'll break it down:

"You will have to write" <- Understand this bit.
"a plugin" <- What kind of plugin? A DLL?
"that" <- Okay with this bit.
"subclasses" <- How do you mean? Like working with the HWND or something?
"the main window" <- This bit's fine.
Alasdair is offline   Reply With Quote
Old 20th May 2005, 17:47   #17
wanderer
Guest
 
Posts: n/a
looks like this one does something like that process... http://forums.winamp.com/showthread....85#post1638685
  Reply With Quote
Old 20th May 2005, 22:36   #18
Alasdair
Junior Member
 
Join Date: May 2005
Location: England
Posts: 10
Ahhhh, I need lots of this kind of thing and it seems very complicated. It looks like NSIS can't be used to make my complicated setup programs, which is a pity because I thought it was looking good.

I know you people are all NSIS fans, but are there any other good scripted installer creators (free or commercial) that allow more flexibility in terms of UI? (And not Inno Setup because I just left that as it's not powerful enough.)

And thank you for all your help!
Alasdair is offline   Reply With Quote
Old 20th May 2005, 23:19   #19
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I don't think so.
And trust me, NSIS is extremely flexible...
http://hmd.hostileintent.org/mapupdater
Software for updating computer games written in NSIS.

-Stu
Afrow UK 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