Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Change textbox text at runtime (http://forums.winamp.com/showthread.php?t=389274)

pkonduru 19th January 2016 18:59

Change textbox text at runtime
 
Hi All,

I have a custom dialog I created using NSD from the Coolsoft NSIS designer.
I have a check box on the Dialog with some standard string say "Check this".
I am trying to change the Value of this during runtime. The code from the dialog designer is below:

; === CheckBox1 (type: Checkbox) ===
${NSD_CreateCheckbox} 50.03u 73.23u 110.58u 14.77u "Check This"
Pop $hCtl_ExistingHub_CheckBox1

If I do this in my installer, it doesnt change the text:

${NSD_SetText} $hCtl_ExistingHub_CheckBox1 "Check that"
I tried putting this line before calling the function that shows the page.

Any inputs?

JasonFriday13 20th January 2016 08:21

If you want to change the text before showing the page, just change the text in the first line (the one that creates the checkbox). If you want to change the text when it's clicked, you have to use a function callback and use ${NSD_SetText} in that.

pkonduru 20th January 2016 21:03

Hi Jason,

Thank you for the reply. The problem with the Coolsoft NSIS designer is one cannot edit the code that it generates, within the .nsdinc file. So,I was thinking if there is anyway say I make a list box/ checkbox and generate the list items or checkbox items from my .nsi file.

JasonFriday13 21st January 2016 08:14

Does it set the read-only flag on the .nsdinc file? (right click -> Properties -> Attributes:).

Unfortunately it becomes very difficult to manage both user code and wizard generated code. NSIS is a scripting language, eventually you will learn how to code installers from scratch if you use it often enough.

I would say do as much as you can in the wizard, then manually add the extra bits you need. I would say if you use the wizard again after this, it would probably overwrite all the extra code you put in, wasting more time.

Anders 21st January 2016 19:42

It works just fine, you must be doing something wrong:

PHP Code:

Var MyCheckbox
Page Custom MyPage
Page InstFiles
!include nsDialogs.nsh
Function MyPage
nsDialogs
::Create 1018
Pop 
$0
${NSD_CreateCheckbox50.03u 73.23u 110.58u 14.77u "Check This"
Pop $MyCheckbox
${NSD_SetText$MyCheckbox "Check that"
nsDialogs::Show
FunctionEnd 


pkonduru 27th January 2016 23:11

Thanks Jason, thats what am doing these days. Just generating the UI code using the designer and using that in my installer.
Like you mentioned editing the file and re-opening again in wizard overwrites all my changes.

pkonduru 27th January 2016 23:12

Hi Anders,

Thank you for your repky.
Yes, the piece of code you provided works fine but the Createcheckbox is in the designer code and the settext is in my nsi which doesnt seem to work.


All times are GMT. The time now is 18:01.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.