Old 22nd July 2007, 11:36   #41
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
code:

!macro __NSD_Event NAME HWND FUNC

Push $R0
GetFunctionAddress $R0 ${FUNC}
nsDialogs::${NAME} /NOUNLOAD ${HWND} $R0
Pop $R0

!macroend

!macro __NSD_DefineEvent NAME

!define NSD_${NAME} "!insertmacro __NSD_Event ${NAME}"

!macroend

!insertmacro __NSD_DefineEvent OnBack
!insertmacro __NSD_DefineEvent OnClick
!insertmacro __NSD_DefineEvent OnChange



${NSD_OnClick} $HWND MyOnClickFunction
${NSD_OnBack} $HWND MyOnBackFunction
${NSD_OnChange} $HWND MyOnChangeFunction

Stu
Afrow UK is offline   Reply With Quote
Old 22nd July 2007, 18:20   #42
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Quote:
Originally posted by FoBoT
does the BrandingImage stuff work with this yet?
I copy/pasted the commands below into InstallOptions.nsi pointing to my .ini file

ChangeUI all "${NSISDIR}\Contrib\UIs\modern.exe"
AddBrandingImage top 20
SetBrandingImage "$PLUGINSDIR\logo.bmp"

from a working InstallOptions version and it displays correctly except the logo is missing from the top of the page
AddBrandingImage is unrelated to nsDialogs. It adds an image control to the external dialog and not the internal dialogs, such as those created by nsDialogs. logo.bmp was probably not extracted to $PLUGINSDIR.

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 28th July 2007, 13:06   #43
bnicer
Senior Member
 
Join Date: Feb 2005
Location: London
Posts: 218
code:
Function OnClick
MessageBox MB_OK "Setup will now abort."
Quit
FunctionEnd

I have a problem with Quit here. Sorry to be disruptive again.
bnicer is offline   Reply With Quote
Old 28th July 2007, 13:37   #44
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
What's exactly the problem?

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 28th July 2007, 14:35   #45
bnicer
Senior Member
 
Join Date: Feb 2005
Location: London
Posts: 218
I think you can't create a custom button that closes the installer. The Back, Next and Close buttons are hidden. That's the plan.
bnicer is offline   Reply With Quote
Old 28th July 2007, 15:26   #46
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
What happens? Does the installer not quit?

Stu
Afrow UK is offline   Reply With Quote
Old 28th July 2007, 15:38   #47
bnicer
Senior Member
 
Join Date: Feb 2005
Location: London
Posts: 218
Yes, it doesn't quit. nsDialogs is so full of shortcuts, I was kind of hoping that would be another one.
bnicer is offline   Reply With Quote
Old 28th July 2007, 16:54   #48
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
That's not currently possible as the code handling g_quit_flag is in the installer itself, separate from nsDialogs which doesn't have access to this flag. That wasn't a problem until the direct function callbacks were added. I need to think how it'd be best to handle this. Please submit a feature request.

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 31st July 2007, 12:34   #49
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I'm guessing calling Abort won't work but how about sending WM_NOTIFY_OUTER_NEXT with a value of 120 (cancel)?

Stu
Afrow UK is offline   Reply With Quote
Old 31st July 2007, 19:21   #50
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
I don't know how well that'd work, considering it might start unloading while still handling another callback. It needs testing.

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 1st August 2007, 00:52   #51
randomSurfer
Junior Member
 
Join Date: Aug 2007
Posts: 1
I want to resize the NSIS installer window when I display a custom page. Can I specify new rectangle params for nsDialogs::Create? I looked into INI file's Settings\RECT that states "RECT: Overrides the default rect ID to run over. This will make IO resize itself according to a different rect than NSIS's dialogs rect."
What is this rect ID ?

This is what I am trying to do :

Page custom "ShowBrowser" "LeaveBrowser"

function ShowBrowser
nsDialogs::Create /NOUNLOAD 1044 ;how can I resize this window?
Pop $R1
SetPluginUnload alwaysoff
SetOutPath "$INSTDIR\temp"
System::Call 'installer::ShowWebPage(i) v (R1)'
nsDialogs::Show
GetDlgItem $0 $HWNDPARENT 1
EnableWindow $0 1
functionend

Any help will be appreciated.
Thanks
randomSurfer is offline   Reply With Quote
Old 1st August 2007, 06:20   #52
bnicer
Senior Member
 
Join Date: Feb 2005
Location: London
Posts: 218
Quit function

An nsDialogs Close button would be convenient. I hope it works. Thanks.

randomSurfer, you can resize the controls and the installer window with Resource Hacker. For mui custom pages it's dialog 105, modern.exe. The changes will be visible in other pages.
bnicer is offline   Reply With Quote
Old 3rd August 2007, 12:21   #53
jdpipe
Junior Member
 
Join Date: Mar 2005
Location: Canberra, Australia
Posts: 11
This plugin ins great but obviously in dire need of some documentation, however meagre. *PLEASE* try to write something? The examples don't even have commenting.

My particular problem: how to retrieve the value from a checkbox after the user leaves the page?
jdpipe is offline   Reply With Quote
Old 3rd August 2007, 12:26   #54
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Send the BM_GETCHECK to the control.
code:
SendMessage $CHECKBOX ${BM_GETCHECK} 0 0 $0
If $0 is 0, it's unchecked. If it's 1, it's checked. Anything else is an intermediate state.

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 3rd August 2007, 15:25   #55
jdpipe
Junior Member
 
Join Date: Mar 2005
Location: Canberra, Australia
Posts: 11
Thanks for that. Can you also tell me: what are the parameters for the '${NSD_CreateCheckbox}' command?
jdpipe is offline   Reply With Quote
Old 3rd August 2007, 15:46   #56
jdpipe
Junior Member
 
Join Date: Mar 2005
Location: Canberra, Australia
Posts: 11
More questions: Do I need to use 'BM_SETCHECK' to set a new checkbox to 'checked'? Or can I do that via NSD_CreateCheckbox?
jdpipe is offline   Reply With Quote
Old 3rd August 2007, 16:14   #57
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
NSD_CreateCheckbox, like every other NSD_Create* takes x, y, width, height and text. To set the state of a checkbox, use BM_SETCHECK.

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 3rd August 2007, 20:40   #58
lushdog
Junior Member
 
Join Date: Jul 2007
Posts: 37
Showing, hiding GUI elements...

Just wondering if you can re-create the style of the MS installers that show and hide a checkmark image if the CD-KEY entered is valid.

I have the code setup now to show a message box if the key length is valid so I'd just have to change that code to show/hide an image on the page.
lushdog is offline   Reply With Quote
Old 3rd August 2007, 21:35   #59
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
just get a handle to that checkmark and, in the callback function of the nsdialog item, use showwindow <hwnd> 0|1 to hide / unhide it?
Animaether is offline   Reply With Quote
Old 4th August 2007, 16:46   #60
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Not 0|1 but ${SW_SHOW} and ${SW_HIDE} (SW_SHOW being 5 not 1).

Stu
Afrow UK is offline   Reply With Quote
Old 4th August 2007, 19:04   #61
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
yeah, alright... ${SW_SHOW} and ${SW_HIDE}. Don't forget to include WinMessages.nsh .

( Note that as far as controls are concerned SW_SHOW or SW_SHOWNORMAL have the same effect. The only time you get a difference if it's actually a window. Why 'hide' is zero and 'show is -not- one, and why showwindow is what one uses on -controls- in the first place is beyond me. Microsoft, right? )
Animaether is offline   Reply With Quote
Old 7th August 2007, 13:42   #62
lushdog
Junior Member
 
Join Date: Jul 2007
Posts: 37
How does one get a Handle to a specific control on a custom page?

Last edited by lushdog; 7th August 2007 at 16:17.
lushdog is offline   Reply With Quote
Old 7th August 2007, 20:36   #63
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
It's returned from ${NSD_Create*} or nsDialogs::CreateItem on the stack.

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 7th August 2007, 23:28   #64
ClayDowling
Junior Member
 
Join Date: Nov 2005
Location: Flint, MI
Posts: 21
Send a message via AIM to ClayDowling
Quote:
Originally posted by Animaether
just get a handle to that checkmark and, in the callback function of the nsdialog item, use showwindow <hwnd> 0|1 to hide / unhide it?
That is an excellent idea. In fact, I'm going to modify the registration component to use nsDialog and implement that feature. Thanks for the idea. Kichik, thanks for putting this extension out.
ClayDowling is offline   Reply With Quote
Old 13th August 2007, 14:35   #65
lushdog
Junior Member
 
Join Date: Jul 2007
Posts: 37
Getting used to the nsDialogs plugin.

Another quick question.

1) I want to show a page with some text.
2) Show animated .gif
3) Run function (function handles moving to the next page)

Currently I can't figure out how to do this.

#Start Connecting Page
Function ConnectingPage

;Create page
nsDialogs::Create /NOUNLOAD 1018
Pop $0

;(*Update)
!insertmacro MUI_HEADER_TEXT "Connecting to the Activation Server" "Please wait while we activate $(^NameDA)."

${NSD_CreateLabel} 0 10 100% 50u "Please wait while we activate $(^NameDA)."
Pop $0

nsDialogs::Show

Call StartActivation

FunctionEnd
#End Connecting Page

Using the above code: "StartActivation" is not run until after the NEXT, BACK or CANCEL buttons are clicked.

If I move "Call StartActivation" before "nsDialogs::Show" then the function is run before the text is displayed.

Any help would be much appreciated.

Thanks.
lushdog is offline   Reply With Quote
Old 13th August 2007, 15:25   #66
lushdog
Junior Member
 
Join Date: Jul 2007
Posts: 37
Got it.

Just changed it so the user had to click next to progress.

#Start Connecting Page
Function ConnectingPage

;Create page
nsDialogs::Create /NOUNLOAD 1018
Pop $0

!insertmacro MUI_HEADER_TEXT "Connect to the Activation Server" "Please continue to activate $(^NameDA)."

${NSD_CreateLabel} 0 10 100% 50u "Please click next to activate $(^NameDA).$\n$\n\
Please be patient as activation may take up to 30 seconds."
Pop $0

nsDialogs::Show

FunctionEnd

Function PostConnecting

Call StartAnimation

Call StartActivation

FunctionEnd
#End Connecting Page
lushdog is offline   Reply With Quote
Old 14th August 2007, 05:31   #67
bradharding
Member
 
Join Date: Sep 2003
Posts: 53
Hi!

Have been spending quite a bit of time rewriting my custom pages to using nsDialogs and must say its a much better way of doing things...

One thing I am having problems with though is the link control.
For example, I have this:

code:

${NSD_CreateLink} 29u 125u 96u 10u "http://nsis.sourceforge.net/"
Pop $LINKCONTROL
${NSD_OnClick} $LINKCONTROL OnLinkClick
SetCtlColors $LINKCONTROL ${BLUE} ${WHITE}



The problem is setting the text colour of the link. For some reason, no text is displayed at all. (Clicking on the link's bounding rectangle works, the OnLinkClick function is called fine.) Any ideas?

Regards,
Brad.
bradharding is offline   Reply With Quote
Old 14th August 2007, 12:03   #68
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
Links are not yet supported.
Joost Verburg is offline   Reply With Quote
Old 14th August 2007, 15:05   #69
lushdog
Junior Member
 
Join Date: Jul 2007
Posts: 37
I got the links to work by just putting a link and label in the same area and changing the label text to blue and underlined.

It is a very major pain if the link is in the middle of a sentence but oh well.
lushdog is offline   Reply With Quote
Old 14th August 2007, 17:07   #70
lushdog
Junior Member
 
Join Date: Jul 2007
Posts: 37
How does one set the focus to a control on a nsDialogs page?
lushdog is offline   Reply With Quote
Old 14th August 2007, 18:04   #71
Backland
Senior Member
 
Join Date: Sep 2006
Posts: 150
Check out the win32 API SetFocus()
Backland is offline   Reply With Quote
Old 14th August 2007, 20:47   #72
lushdog
Junior Member
 
Join Date: Jul 2007
Posts: 37
Yeah I got it to work nicely.

How about password character masking?

Thanks.
lushdog is offline   Reply With Quote
Old 16th August 2007, 00:21   #73
sab0tage
Junior Member
 
Join Date: Aug 2007
Posts: 4
I am having trouble getting FileRequest working, I've tried to modify the function as it won't be read from an ini file, but I'm not having much luck.

Does anyone have an example of it working?
sab0tage is offline   Reply With Quote
Old 16th August 2007, 19:42   #74
jeffadams78
Junior Member
 
Join Date: Aug 2007
Posts: 15
Question

Can someone throw together a quick example? I'm not sure how you guys figured this thing out, unless it was just by reading the .nsh and trial and error.

Just something like:

Custom "enter a message" page with a text box, a check box, a button.
Button pops up a message box saying "You pushed the button".
One section that just does a DetailPrint "Contents of text box: " and whatever you typed into the box, and "The check box [was | was not] checked." with whether it was checked or not.

Thanks...
jeffadams78 is offline   Reply With Quote
Old 16th August 2007, 20:08   #75
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
sab0tage, add an OnClick handler to your browse button and call SelectFileDialog to get the user's selection. Then put the result in the text box.
code:
System::Call user32::GetWindowText(i$TEXT_HWND,t.r0,i${NSIS_MAX_STRLEN})

nsDialogs::SelectFileDialog /NOUNLOAD save $0 "All Files|*.*"
Pop $0

${If} $0 != ""
SendMessage $TEXT_HWND ${WM_SETTEXT} 0 STR:$0
${EndIf}


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 16th August 2007, 20:09   #76
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
jeffadams78, there are examples in Examples\nsDialogs. From there on, it's trial and error for now.

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 16th August 2007, 20:18   #77
jeffadams78
Junior Member
 
Join Date: Aug 2007
Posts: 15
Duh, nevermind... just found the examples installed under /NSIS/Examples/nsDialogs if you install the new version of NSIS.

Quote:
Originally posted by jeffadams78
Can someone throw together a quick example?
jeffadams78 is offline   Reply With Quote
Old 16th August 2007, 20:20   #78
jeffadams78
Junior Member
 
Join Date: Aug 2007
Posts: 15
Heh, and it would appear I failed to refresh the page before posting. Thanks anyway though!

Quote:
Originally posted by kichik
jeffadams78, there are examples in Examples\nsDialogs. From there on, it's trial and error for now.
jeffadams78 is offline   Reply With Quote
Old 16th August 2007, 23:06   #79
sab0tage
Junior Member
 
Join Date: Aug 2007
Posts: 4
Thanks kichik, I will give that a go.

I've put together the following macros, I'm pretty new with trying to put these together but they work for me.

code:

!macro _NSD_ENABLE NAME TOGGLE
SendMessage ${NAME} ${WM_ENABLE} ${TOGGLE} 0 $R0
Push $R0
!macroend
!define NSD_ENABLE `!insertmacro _NSD_ENABLE`

!macro _NSD_CHECKSTATE NAME
SendMessage ${NAME} ${BM_GETCHECK} 0 0 $R0
Push $R0
!macroend
!define NSD_CHECKSTATE `!insertmacro _NSD_CHECKSTATE`


I'm not sure if I need to push $R0 in the macro or pop it after it's called, but it works...


code:

Function CheckboxEvent
${NSD_CHECKSTATE} $CHECKBOX_ID
Pop $0

${NSD_ENABLE} $TEXTBOX_ID $0
FunctionEnd



${NSD_CHECKSTATE} checks the value of the checkbox and the returned value is used to disable a textbox with ${NSD_ENABLE}.

It might be of some use to somebody.
sab0tage is offline   Reply With Quote
Old 23rd August 2007, 18:08   #80
jeffadams78
Junior Member
 
Join Date: Aug 2007
Posts: 15
Hmm, so the FileRequest function really isn't for use in new totally nsDialog-driven stuff, just for working with ini files?
jeffadams78 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