Skip to content
⌘ NSIS Forum Archive

How to resize and set position the next button

7 posts

meoit#

How to resize and set position the next button

Hi all!

I need resize the next button, width = x2.
and set position to 10u from the old position.

I do not know user32::GetWindowRect, user32::SetWindowPos

Someone help me.

Thanks.
r2du-soft#
try this:
!include "MUI2.nsh"

Page Custom Button_Test
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_LANGUAGE English


Function Button_Test

nsDialogs::Create 1044
Pop $R0
${If} $R0 == error
Abort
${EndIf}

GetDlgItem $0 $HWNDPARENT 1 ;NEXT button
System::Call 'USER32::MoveWindow(p$0,i120,i60,i240,i130,i1)'
#(Control HWN ; Horizontal Posation ; Vertical Posation ; Controller Vertical Size ; Controller Horizontal Size)

GetDlgItem $0 $HWNDPARENT 1 ;NEXT button
${NSD_AddExStyle} $0 "${WS_EX_TRANSPARENT}|${WS_EX_TOPMOST}" ;Add Button To TOP |FIX hide Button|

nsDialogs::Show
FunctionEnd


Section

SectionEnd
r2du-soft#
Also see this Examples:

Example 2:
!include "MUI2.nsh"

!define MUI_CUSTOMFUNCTION_GUIINIT onGUIInit
Page Custom Button_Test

!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_LANGUAGE English

Var BTN_NEXT


Function onGUIInit
GetDlgItem $0 $HWNDPARENT 1 ;NEXT button
ShowWindow $0 ${SW_HIDE}
FunctionEnd


Function Button_Test

nsDialogs::Create 1044
Pop $R0
${If} $R0 == error
Abort
${EndIf}

${NSD_CreateButton} 80 50 240 90 "NEXT Page Show"
Pop $BTN_NEXT
${NSD_OnClick} $BTN_NEXT BTN_NEXT_Click

nsDialogs::Show
FunctionEnd

Function BTN_NEXT_Click
Pop $0
SendMessage $HWNDPARENT ${WM_COMMAND} 1 "" ;Next
FunctionEnd



Section

SectionEnd



Example 3:
!include "MUI2.nsh"

Page Custom Button_Test

!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_LANGUAGE English

Var BTN_NEXT


Function Button_Test

nsDialogs::Create 1044
Pop $R0
${If} $R0 == error
Abort
${EndIf}

${NSD_CreateButton} 80 50 240 90 "NEXT Page Show"
Pop $BTN_NEXT
${NSD_OnClick} $BTN_NEXT BTN_NEXT_Click

nsDialogs::Show
FunctionEnd

Function BTN_NEXT_Click
Pop $0
SendMessage $HWNDPARENT ${WM_COMMAND} 1 "" ;Next
FunctionEnd



Section

SectionEnd
Anders#
The code posted by r2du-soft uses pixels, not dialog units which is what you asked for.

Do you want to size the button on all pages or just a single page?
meoit#
@r2du-soft

I set font Tahoma for the Installer

When I tried rename Tahoma.ttf, result: The Next Button is no longer located where I want.

How to fix this?.