Archive: InstallOptions


InstallOptions
I just played around with the new contrib InstallOptions and noticed the following:

- Window doesn't update correctly
- edit controls dont autoscroll

Attached is a patch which fixes bot issues and adds a new feature
for controls of type "DirRequest":
By setting Text=... you can set a root directory to browse in.
I use that now for a dialog which enables selection of program
group for installing shortcuts in startmenu.
Another change, i made is allocating the HWNDList dynamically.

Apart from these issues, InstallOptions a very useful extension.
-Fritz


I've got that problem too.

Can You tell me how to apply that patch,
which utilities are needed, etc... ?

Or, maybe, you can post the patched
InstallerOptions.cpp file itself?
It is not that big, especially zipped :)

Thanks in advance


Originally posted by alexj
I've got that problem too.

Can You tell me how to apply that patch,
which utilities are needed, etc... ?

Or, maybe, you can post the patched
InstallerOptions.cpp file itself?
It is not that big, especially zipped :)

Thanks in advance
diff and patch are the usual tools for distributing source changes
in the Unix (Linux) world.
I use patch.exe which is part of cygwin, a very useful
posix environment, freely available at http://sources.redhat.com/cygwin/

Unpack the zipfile, then
cd into the directory where your original .cpp is and run
patch -p0 < /path/where/you/unzipped/InstallerOption.patch

Ciao
-Fritz

BTW:
Hardcore programmers also can read the .patch (it's a text-file) and apply the changes by hand ;) :

Each change begins with a line

@@ -o1,o2 +n1,n2

where
o1 is the start line-number in the old file
o2 is the end line-number in the old file
n1 is the start line-number in the new file
n2 is the end line-number in the new file

Then (in unified diffs like this) 2 lines of unchanged context
follow, followed by the changed lines, followed by another 2 lines
of unchanged context. The changed lines are simply prefixed by '-'
or '+'. '-' means "delete that line", '+' means "add that line".

Pretty simple, eh?

Thanks .

Actually, that's what I did while waiting for Your answer :)

But next time I'll use patch, sure.

- Alex J.


One quick point about this patch.
The HWNDList is not used for the controls which you define, but rather for the controls on the main NSIS dialog. The reason they aren't allocated dynamically is because it would require counting the enumerating the controls an extra time.
Anyway, the patch has a bug if the number of controls on the NSIS window is greater than 2*(number of option controls+10).
This will work most all the time, but it is a potential bug (not that the hardcoded limit of 150 is much better).

I'll merge the changes into the Install Options source and let you know when it's done.


Originally posted by locnar42
One quick point about this patch.
The HWNDList is not used for the controls which you define, but rather for the controls on the main NSIS dialog.
Of course you are right. I realized that when i looked closer into the source (my patch was a 5min quickhack to get what i wanted). But you don't need to count them. I now changed the HWNDList to a linked list where elements get added on initial traversal of the window-hierachy. Size of exe is still the same and number of windows is now virtually unlimited.
More in a PM ...

-Fritz

update available
Ok, so I posted a new version of Install Options to the website. Click here to download it.

This version adds a couple of things.

Also, I went ahead and wrote the code to allocate HWNDList dynamically.

Let me know if you experience any problems, or if you have any other requests.

michael

Well, it still has some display flaws.
The initial display is correct, but when some other window is moved above (e.g. The BrowseForDir-Window), then the "old" contents of the installer window gets partially displayed (see attached jpg). I think, the main reason for that is the wait-loop in the ExecWait function of NSIS which still dispatches WM_PAINT messages. But i may be wrong with that (Im a UnixGuru not a WinGuru).

Meanwhile i have "DLLified" InstallerOptions and added 3 things to NSIS:[list=1][*]An ExecDLL command for running a function in a DLL (basically LoadLibrary(), GetProcAddress(), calling external func, pushing result on stack)[*]The .onDlgPage feature described in my Post "A better integration of InstallOptions"[*]An additional variable $SECTIONS which reflects the current selected components. (For running some dialogs conditionally)[/list=1]

When running as DLL, this has several advantages. For example, the caller (NSIS) can provide some additional internals to the called function. Also, the existing Buttons and Icons can be reused. I simply change the DialogProc temporarily, so that the Cancel, Back and Next Buttons are used instead of the Ok. (The Ok seems to appear somewhat surprising, especially because the the user thinks that he is still using the same program). The Icon is kept and the "ComponentText" temporaily replaced.
The only disadvantage is size. The same code results in 24k when compiled as DLL. Luckily, most of this added space seems to be good compressable relocation table or so. Compressed size is still app. 5k.

-Fritz


felfert,
What version of windows are you using?
Also, what is your localized language?

The main reason IO isn't a DLL is the main NSIS distribution doesn't support it. If Justin adds this support, then I'd agree and would probably switch it. Until then, I would much rather it work with all versions. I think my biggest complaint with the current workings is there is no way to run it until after the installation starts copying files.

From my perspective, if I was going to modify NSIS to run the DLL, then I would much rather add all of IO into NSIS by adding Dialog/DialogEnd commands (which is actually where I started).


Same Problem
I'm running Windows 98 SE and my local language is English.. I get the exact same redraw problems mentioned in this post..

Is this just my system or a real problem?