Archive: how do I do this?


how do I do this?
  Hi, I'm using MUI2 and got a question.

I have an installer which installs the app completely new or update it (choosing on component page).
On update the other pages before Install Page like Directory Page and Start Menu Page are skipped so that when the user clicks on the button "Next >", that he gets directly to install page which starts to install immediately.

So I want the "Next" button's Caption on Component Page to change at runtime depending on the choice install type.

Is it possible?

Thanks for any help or hint.


Hint: You can use SendMessage to change the text on a button:

SendMessage $0 ${WM_SETTEXT} 0 "STR:NewText"

The SendMessage command is described in the User Manual: http://nsis.sourceforge.net/Docs/Cha...html#4.9.14.10

The forum search feature will find you some other examples showing how to use SendMessage to change the text on a button.


Originally posted by pengyou
[B]Hint: You can use SendMessage to change the text on a button:
thanks for your hint.

I used it on function .onSelChange and it works great.


onSelChange

GetCurInstType$7
StrCmp$7 "1" install next
install:
GetDlgItem $0 $HWNDPARENT 1
SendMessage$0 ${WM_SETTEXT} 0 "STR:Install"
Goto done

next:
GetDlgItem $0 $HWNDPARENT 1
SendMessage$0 ${WM_SETTEXT} 0 "STR:Next >"

done:
>FunctionEnd
>

"STR:Install" and "STR:Next >" are fine if you only use English in your installer.

If your installer has to support other languages you can ensure that the button uses the correct text by using

"STR:$(^InstallBtn)" and "STR:$(^NextBtn)"

This will make sure that your installer uses the correct language when it changes the button text instead of always using English.