Archive: Dynamic "Space required" text


Dynamic "Space required" text
  Is there a way I can change what the "Space required" text is during run-time?

One of the components the user can select will actually free space. I kind of thought that having "Space Required: -xxMB" would be a little odd, (not to mention it seems you can't do it) so I thought about chaning the actual text.

After messing about with SendMessage in .onSelChange, I found out that it changes the whole text area including the numbers (well duh) instead of that specifc text.

Also, as soon as the .onSelChange function ends, the text reverts back to default.

So, my question is, is it possible to change it when someone clicks on a component?

If so, how?
(Or should I just look into using a custom page with InstallOptions?)


Edit: On a non-related note, while I was looking through the documentation I saw this:

Sets the Size of the section specified by section_index. Note that the Index starts with Zero. The Value for Size must be entered in KiloByte and supports only whole numbers.
Then the example gives:

onInit

# set required size of section 'test' to 100 bytes
SectionSetSize ${test_section_id} 100
FunctionEnd
>

No sure if I got your point, though,
Open the WelcomeFinish.nsi MUI example, scroll down to the language descriptions area and add the following code:

  LangString ^SpaceRequired ${LANG_ENGLISH} "This text changed: "

Hmm, reading your reply made me think of header files... Is the string defined there somewhere?

I'm not sure it will solve my problem though, anyways, here is the problem I face. I need TWO possible texts for that field.

Either:
"Space Required"

Or:
"Space Saved"

Thanks for your reply


Hmm, reading your reply made me think of header files... Is the string defined there somewhere?
See the included languages.nsi example, also you may want to open with a text editor the language file english.nlf for more details.

SpaceTexts sets that text. You could set it to a variable and change the value of that variable at runtime to "Space required: " or "Freed space: ".


Ah, thank you for that!

I modified the English.nlf file, and changed the default text into a variable, and that worked perfectly!

I just used some extra steps to calculate the real space that was saved from other installed modules, etc.

Thank you very much for that.

Edit: oops, so there's another method for that? Oh now that you mention it, I remember seeing something like that, but at the time I only tried setting it to a hard value in .onSelChange and it complained saying it had to be used not in a function or section. Hee hee I totally didn't think of using a variable!!

Thank you kichik and Red Wine!


You shouldn't change the NLF. You'll have to distribute the NLF with your script or change the original NLF before compiling your script for every new installation of NSIS. Use SpaceTexts instead.


Yeah, I can see the adverse affects in doing that, but until I read your post I couldn't think of going about it another way.

Thank you.