Old 1st August 2014, 09:39   #1
w000t
Junior Member
 
Join Date: Aug 2014
Posts: 5
Checkboxes in "PageEx directory"

Hey guy,

how do I make something like this

code:

Var /GLOBAL INSTALL_DIR
Var /GLOBAL CHECKBOX

PageEx directory
Caption ': Installationsverzeichnis'
DirText "text here" "" "" "text here"
DirVar $INSTALL_DIR
${NSD_CreateCheckbox} 0 -50 100% 8u Test
Pop $CHECKBOX
PageExEnd



I included this file in my installer but it won't work.
While this does:

code:

Var /GLOBAL INSTALL_DIR

PageEx directory
Caption ': Installationsverzeichnis'
DirText "text here" "" "" "text here"
PageExEnd

w000t is offline   Reply With Quote
Old 1st August 2014, 10:29   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,449
NSD_* macros only work on custom pages that use the nsDialogs plugin, if you want to change the standard dialogs you must use Resource Hacker and the ChangeUI instruction...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 1st August 2014, 10:40   #3
w000t
Junior Member
 
Join Date: Aug 2014
Posts: 5
Quote:
Originally Posted by Anders View Post
NSD_* macros only work on custom pages that use the nsDialogs plugin, if you want to change the standard dialogs you must use Resource Hacker and the ChangeUI instruction...
Is there any other way?
We remcompile the Installer pretty often, so it would be no so good to use ResHacker every time.

The thing I want is a page that looks like the standard page but with a checkbox.
(I want the checkbox to provide "Advanced settings")

________________________________________________________
Edit: Okay if this doesn't work, here is an other question.

If my checkbox is not checked, then I want to skip the next 2 pages.

Quote:
Originally Posted by checkbox.nsi

Var /GLOBAL CHECKBOX
Var /GLOBAL ADVANCEDMODE
Function nsDialogsPage

nsDialogs::Create 1018
Pop $0

${NSD_CreateCheckbox} 60% -50 100% 8u "Advanced settings"
Pop $CHECKBOX
GetFunctionAddress $0 OnCheckbox
nsDialogs::OnClick $CHECKBOX $0
nsDialogs::Show

FunctionEnd

Function OnCheckbox
Pop $0
StrCpy $ADVANCEDMODE $0
MessageBox MB_OK "Checkbox clicked!!!"
FunctionEnd
And the relevant part of the other file looks like this:

Quote:
Originally Posted by installer.nsi

!include checkbox.nsi
Page custom nsDialogsPage
!include install-dir-selection-page.nsi
${If} $ADVANCEDMODE == "0"
!include chrome-selection-page.nsi
!include java-selection-page.nsi
${Endif}
Whats wrong with it?
w000t is offline   Reply With Quote
Old 1st August 2014, 12:13   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,449
You only use Resource Hacker once on a file in \NSIS\Contrib\UIs and save as a new .exe that you give to ChangeUI in the script.

To skip a page you must call Abort in the pre-callback for that page...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 1st August 2014, 12:51   #5
w000t
Junior Member
 
Join Date: Aug 2014
Posts: 5
Quote:
Originally Posted by Anders View Post
To skip a page you must call Abort in the pre-callback for that page...
But how I can I do this with included files? (I am sorry, I am little bit confused too much NSIS for today I guess)

Edit:

I just wrote this in my "java-selection-page.nsi"file and it seems not the work

Quote:
PageEx directory
${If} $ADVANCEDMODE == 0
Abort
${EndIf}
Othercodeishere
PageExEnd
w000t is offline   Reply With Quote
Old 1st August 2014, 22:14   #6
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 916
Quote:
Originally Posted by w000t View Post
But how I can I do this with included files? (I am sorry, I am little bit confused too much NSIS for today I guess)

Edit:

I just wrote this in my "java-selection-page.nsi"file and it seems not the work
Quote:
PageEx directory
${If} $ADVANCEDMODE == 0
Abort
${EndIf}
Othercodeishere
PageExEnd
Like Anders said, it has to be in a callback function:
Quote:
Originally Posted by callback_skip.nsi
Name "callback_skip"
OutFile "callback_skip.exe"

PageEx Directory
PageCallbacks DirectoryPre DirectoryLeave
PageExEnd
Page Components
Page InstFiles

Function DirectoryPre
Abort
FunctionEnd

Function DirectoryLeave
FunctionEnd

Section
SectionEnd
Also, this is wrong:
Quote:
!include checkbox.nsi
Page custom nsDialogsPage
!include install-dir-selection-page.nsi
${If} $ADVANCEDMODE == "0"
!include chrome-selection-page.nsi
!include java-selection-page.nsi
${Endif}
You're mixing compile time commands with run time commands. At compile time, all pages must be included, and at run time you can skip pages or do other stuff that's required.

This (http://nsis.sourceforge.net/NonObligatoricPages) is also a good example for run time commands and page skipping.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 4th August 2014, 07:11   #7
w000t
Junior Member
 
Join Date: Aug 2014
Posts: 5
Thank you very much your your answers, it works pretty good so far.

Just one more question, if I check my checkbox then press "Next" and then "Back" then my checkbox doesnt show as checked.
I see where the problem ist, but I dont know how to fix it.

Quote:
Function nsDialogsPage

nsDialogs::Create 1018
Pop $0
${NSD_CreateLabel} 10% 10% 70% 40u "test"
${NSD_CreateCheckbox} 60% -50 100% 8u "test2"
Pop $CHECKBOX
GetFunctionAddress $0 OnCheckbox
nsDialogs::OnClick $CHECKBOX $0
Pop $0
nsDialogs::Show

FunctionEnd

Function OnCheckbox
Pop $0
StrCpy $ADVANCEDMODE $0
FunctionEnd
w000t is offline   Reply With Quote
Old 4th August 2014, 11:14   #8
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,449
You normally don't use OnClick on a checkbox, you just get the state in the page leave callback function with NSD_GetState. When you create the page you need to use NSD_SetState so back works correctly...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 4th August 2014, 11:21   #9
w000t
Junior Member
 
Join Date: Aug 2014
Posts: 5
Thumbs up

Thank you very much for your help!
w000t 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