Archive: Check online for version updates


Check online for version updates
Hi,

i tried to build an update installer
but got stuck with a small problem.

My update installer has a custom page
with a checkbox whether the user
wants to connect to internet and check for updates.

---

Now i want to change the "Close" button
into a next button if the user selected that checkbox.

If the box is unchecked and the user presses "Close"
the installer closes (correct behaviour)

If the box is checked and the user presses "Close"
the next screen appears (correct behaviour)

But i want to show "Next" instead of "Close".

----

Why i named this topic "Check online for version updates"
is that i don´t know if i experience other problems which i´m not able to fix after renaming that button :)

btw. i read s.th. about MiscButtonText but don´t know the correct syntax and how to handle it.

----

Even better:

I uploaded an installer example (NSIS) (too sad i only own the binary). I want to rebuild it and need help / ideas
on how to do that the easiest, fastest and best way.

I just created the custom page. For checking version i wanted to use WordFunc. But i don´t know how to change the button "close" automatically when checkbox is selected and if checkbox selected and user clicks cancel - the updater shouldn´t download and execute the rest (mine now does).

Here´s the link:
senduit.com/b6c79b

(Hope it works without the app installed)


get the Next button control and then send a command to change the text...


GetDlgItem $0 $HWNDPARENT 1 ; 1 = Next button
SendMessage $0 ${WM_SETTEXT} 0 "STR:Hello"


See also..
http://nsis.sourceforge.net/Buttons_Header

The problem is that the button
doesn´t get changed instantly.

The button changes only in the next screen
but it should change (like shown in the "Update" Installer i attached in my first post) directly.

greets
and thanks for the reply


btw. Buttons Header cannot change "Close" Button,
it just can change "Cancel" button - but i need
to change label / caption of the close button.


The 'Close' button is the 'Next' button - NSIS (or the UI front-ends) itself just changes the label on it, so you should ignore the Cancel button :)

Here's an example using NSDialogs for the checkbox - if you use InstallOptions(2/Ex), then just check the checkbox state in the page leave function and call Abort where appropriate.


!include MUI.nsh
!include nsDialogs.nsh

OutFile "c:\testsetup.exe"

Page Custom fnCreate
Page Directory ; dummy page

!insertmacro MUI_LANGUAGE "English"

Var CHECKBOX



Function fnCreate
nsDialogs::Create /NOUNLOAD 1018
Pop $0

${NSD_CreateCheckbox} 0 -50 100% 8u "Test"
Pop $CHECKBOX
GetFunctionAddress $0 OnCheckbox
nsDialogs::OnClick /NOUNLOAD $CHECKBOX $0

nsDialogs::Show
FunctionEnd

Function OnCheckbox
GetDlgItem $R0 $HWNDPARENT 1 ; 1 = Next button
Pop $0 # HWND
${NSD_GetState} $0 $1
IntCmp $1 1 _Close _Next
_Close:
SendMessage $R0 ${WM_SETTEXT} 0 "STR:Close"
goto _done
_Next:
SendMessage $R0 ${WM_SETTEXT} 0 "STR:Next"
_done:
FunctionEnd

Section
SectionEnd