How to Create Buttons With Disable Enable Option in NSIS? - nsis

I want to create a custom page in NSIS. In that page I need to create some buttons... Those buttons may be disable or enable mode based on a condition... Following is the code for create button
nsDialogs::Create 1018
Pop $0
${NSD_CreateButton} 275 1 20% 12u "Stop Service"
Pop $BUTTON
GetFunctionAddress $0 StopService
nsDialogs::OnClick $BUTTON $0
nsDialogs::Show
${NSD_CreateButton} option will create the button with enable mode... But I want o create with disable mode.. I have referred the links, but I could not able to find the solution... How can I achieve this on loading the page itself?

Just after the Pop $BUTTON, send a disabling message to the button:
EnableWindow $BUTTON 0

Related

Back Button gets hidden in choose StartMenu Page for NSIS - Ultra Modern UI

I have pages lined up like this:
!define MUI_PAGE_CUSTOMFUNCTION_PRE PageCheck ;Hiding Welcome Page if needed
!insertmacro MUI_PAGE_WELCOME
Page custom ChooseDirAndOverWrite ChooseDirAndOverWriteLeave
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_DEFAULTFOLDER $StartMenuDefault
!insertmacro UMUI_PAGE_ALTERNATIVESTARTMENU "Application" $StartMenuFolder
!insertmacro UMUI_PAGE_CONFIRM
When I reach the screen "choose Startmenu folder", which is !insertmacro UMUI_PAGE_ALTERNATIVESTARTMENU "Application" $StartMenuFolder, the Back button is visible for a split second and then gets hidden, only on first time.
On clicking next, then coming back, the Button is enabled there onwards.
What may be causing this behaviour, and where can I get it corrected ?
Also, I read that Ultra Modern UI StartMenu Page does not have a Show Function. Is there a work around for it ?

How to change Progress bar length in MUI instfiles page and arrange button position?

I'm using the MUI Page INSTFILES in my Installer and I want to change the length of the Progress bar and the Position of the "Show Details" Button in it.
Is this possible still using the MUI Page or do I have to make my own custom Page with nsDialogs?
You can use Resource Hacker to edit ${NSISDIR}\Contrib\UIs\modern.exe and then use this new UI resource:
!define MUI_UI myNewUI.exe
!include MUI2.nsh
...
The other alternative is to call SetWindowPos or MoveWindow with the system plugin at run-time but this is a bit harder to do...

Change Button Text in MessageBox

When I use the AfxMessageBox with MB_OK the messagebox is shown with 'ok' as button text and when i use the MB_YESNO it is shown with 'Oui' for Ok and 'Annuler' for No (I am running under French Windows).
I want to know if I could change the text button of my MessageBow without creating a custom one? or is it possible to hide the cancel button when i use the MB_YESNO?

Change the text of the button from next to install after accepting license agreement?

I want to change the button text from next to install once the user accepts the license agreement. Clicking the radio button of accepting the license agreement should change the text of the button from next to install.
There are no hooks that will allow you to change the text based on a event on the license page but you could change the text when you first enter the page:
Page license "" licshow
LicenseForceSelection radiobuttons
Function licshow
GetDlgItem $0 $HWNDPARENT 1
SendMessage $0 ${WM_SETTEXT} 0 "STR:$(^InstallBtn)"
FunctionEnd
or you can use LicenseText "" "$(^InstallBtn)"
If for whatever reason you feel you have to do this you can try the button event plugin...

changing style of NSIS link on hovered

I have a link in my NSIS installer page and I'm trying to change its style (color). The link is declared in my .ini page like this:
[Field 8]
Type=Link
Left=14
Top=18
Right=206
Bottom=28
Text=go to google...
State=https://google.com/
then in the .nsh file i change its style calling:
ReadIniStr $1 "${TEMP}\browse.ini" "Field 8" "HWND"
SendMessage $1 ${WM_SETFONT} $7 0
SetCtlColors $1 0x000000 transparent
It does change the link's style but when i hover it, it goes back to its old style and changes back on refresh (when i drag a window over or press a button that will refresh the field)
The default style looks like a button and i want it to look like an underlined label.
I've also tried to make it label and link it with Linker::link but changing the page skin with NSIS_SkinCrafter_Plugin::skin makes it disappear and i can't bring it back.
Can you please suggest a solution to my problem? I just want a blue underlined text that when hovered opens a webpage in the browser
Try Linker plugin it can change a label into a link.
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1006
Linker::link /NOUNLOAD $0 "http://www.google.com/"

Resources