Archive: Space needed on multiple directory pages


Space needed on multiple directory pages
I am currently trying to use two directory pages, one to choose where to install the program files, and another for data files. This works fine, but the "Space required" box in the bottom left (using MUI if it matters) shows the same amount in both cases.

A couple possible solutions that I don't know how to implement (or if they'll work):

1. Hide the "Space required" label altogether on the data directory page..... but I think it'll still check for the amount of space needed by the program files.

2. Place hidden (automatically skipped) components pages between the directory pages to enable different sections. I don't have any components pages as it stands (I only have one section), if that makes any difference.

3. Use InstallOptions to create a similar dialog without the label. I can't figure out how to update the "Space available" label when the directory is changed though.

Thanks in advance for any help,
Geoff


You can hide the labels on the second components page using FindWindow, GetDlgItem and ShowWindow. To make it ignore the required space you can use DirVerify.


I got it to ignore the required space using DirVerify. That part works great. Thanks. (BTW, in the docs it says DirVerify is set globally, not as part of PageEx, but no problem)

The hiding of the label seems to be a bit of a problem though. Here's my code:


Function DataDirectoryShowFunc

FindWindow $0 "#32770" ""
GetDlgItem $1 $0 1023 ; 1023 = IDC_SPACEREQUIRED
ShowWindow $1 0 ; 0 = SW_HIDE

FunctionEnd

I think it might be hiding the window, then immediately showing it again after this function. Any good way to get around that? (Is moving it offscreen possible/intelligent?)

Where does it say it's global?

Replace the FindWindow line with:

FindWindow $0 "#32770" "" $HWNDPARENT

Good call on the $HWNDPARENT thing. Apparently I was foiled by a word wrap :rolleyes:. It works now, many thanks.

In the NSIS User Manual (that I got with 2.0 Final), under 4.5.2 Page Options, it seems to say that the only two things you can use specifically in a directory selection PageEx block are DirVar and DirText. Apparently that's not the case.

Also, when you click them from there, it takes you to 4.8.1 General Attributes, which seem to be mostly "global" settings (ChangeUI and CRCCheck) and some which are specifically noted as being used only in a PageEx block (DirVar). Maybe a note should be added to DirVerify as well to say that it can only be used inside of PageEx.

I also happened to find something called SpaceTexts, which kind of looked like it might have been the right way to do this. It seems odd to me, though, that you can only disable both texts at once, and not specify one or the other.

Anyways, I think NSIS is great, and the service on the forum is amazing. Can't thank you enough for the effort you're putting in.


Oh right, it's only listed under 4.5.2 in the latest CVS version.


Is there any chances that developers will add ability to set "space required" field in directory page?
I wrote installer, that unpack contents into two different directory: all sections except one into $INSTDIR and one section into another dir, very possibly situated on another drive. Both directories are selected by user (two MUI_PAGE_DIRECTORY macros in script).
Currently I have only ability to turn off space check (DirVerify off), hide label (SpaceTexts none) and leave users in the dark of ignorance. If I don't did so, they will have incorrect requirements in both directory pages and even possibly incorrectly grayed "Next" button.

BTW, looking for answers for my questions I begin to understand whole structure of NSIS code :) For example, for this question I find lines in exehead\Ui.c:

total = sumsecsfield(size_kb);
if ((unsigned int)available < (unsigned int)total)
error = NSIS_INSTDIR_NOT_ENOUGH_SPACE;



That's the core of my trouble: total is function-local int variable...

You can change each section's size requirement with SectionSetSize.


Yes, I know. But it will looks like:
1. Before showing dialog with selection main directory I must turn off (or set size to zero) that section, which must install into additional directory. And then first directory page will show and check correct installation size.
2. Before showing dialog with selection additional directory I must turn off (or set size to zero) all sections except one which must install into this directory.

While first operation is simple to implement, second is complex, at least I dont know easy way to save and restore state of bunch of section.

Hmm... I suddenly understand that setting section size to zero will not affect installation process! And I don't need to return it to actual state! So, is there any way to loop over all sections with for-like cycle? Because my installer has a lot of sections (except this pecular installed separately), and will have even more in future, and I don't want to insert a lot of SetSectionSize in my script and not forget insert even more in future.


Define a dummy section which will be the last section. Loop from 0 to its id to go over all sections.


Also SectionSetSize set error flag if index is out of bound, and it's enough.

But I forgot that user can press Back button... So I need to return actual sizes to sections in component's page pre-function. I need arrays in NSIS script!

I think it's simpler to rewrite directory page for me using InstallOptions :)

Anyway, thanks.