- NSIS Discussion
- MUI Components Page -- How can I control features checked and highlighted
Archive: MUI Components Page -- How can I control features checked and highlighted
MidnightJava
24th September 2006 21:15 UTC
MUI Components Page -- How can I control features checked and highlighted
I'm using MUI with the Components page. The desired features show up, both checked, and the first one is highlighted. Is there a way to control which features are selected and/or highlighted by default?
kichik
24th September 2006 23:10 UTC
To make a section not selected by default, use the /o switch in the section definition line.
To highlight a different section by default, send the appropriate message to the tree view in the show callback function of the components page. WinMessages.nsh contains definitions of messages, including tree view messages, iirc.
MidnightJava
25th September 2006 01:30 UTC
Thanks. Sorry I somehow overlooked the /o switch info in the documentation.
Regarding sending a tree view message, can you point me to some background info to read about using window messages? I don't see anything in the docs about them, other than elliptical references here and there; and I have no idea of the context of WinMessages.nsh. I see all the !defines but I have no idea how to make use of them, and tree-view is mentioned only in the comments.
Is it possible to highlight no section by default? That's all I'm trying to do, cause I think the user might confuse the highlight with the check.
kichik
29th September 2006 10:38 UTC
Windows messages are probably best described in MSDN. All you need to know is that it's a form of communicating between windows. You can send the tree view a message saying "select nothing".
Use the following as your components page show function.
!define TVM_SELECTITEM 0x110B
!define TVGN_CARET 0x0009
Function compShow
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1032
SendMessage $0 ${TVM_SELECTITEM} ${TVGN_CARET} 0
FunctionEnd
MidnightJava
10th October 2006 01:35 UTC
Thanks, kichik. Just got around to trying this, and it does exactly what I need.
MidnightJava
15th June 2007 04:35 UTC
Resurrecting this old thread. Kichik gave me a solution for un-highligting sections in my Components page during installation. Now I'd like to do the same thing for uninstalling, but calling the same function doesn't work. I assume one of the values needs to be different, but I'm still completely in the dark as to what all the numbers and symbols in the solution mean, probably cause I'm not a Windows programmer. Can someone help me make this work for uninstalling as well?
Anders
15th June 2007 05:27 UTC
Are you getting compiler errors? If so, make a copy of that function and rename it un.compShow
MidnightJava
15th June 2007 05:39 UTC
That sounds like it may be the problem, but I can't seem to do what you suggested. Here's the function
Function un.compShow
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1032
SendMessage $0 ${TVM_SELECTITEM} ${TVGN_CARET} 0
FunctionEnd
And here's how I invoke it
!define MUI_UNPAGE_CUSTOMFUNCTION_SHOW un.compShow
!insertmacro MUI_UNPAGE_COMPONENTS
And here's what the compiler says
uninstall function "un.compShow" not referenced - zeroing code (284-288) out
This is exactly how I do it for the installation components page, except of the "UN" prefixes. I don't understand why the compiler thinks I haven't referenced the function
MidnightJava
15th June 2007 05:55 UTC
I found the problem
I needed to change
!define MUI_UNPAGE_CUSTOMFUNCTION_SHOW un.compShow
to
!define MUI_PAGE_CUSTOMFUNCTION_SHOW un.compShow
i.e. got rid of the "UN" in the macro name
I had put the "UN" in earlier when it wasn't working right, not realizing I just needed to use it in the function name. I thought the compiler would warn me if I got it wrong, but I'm just now realizing that since it's a define and not a macro name, there's no way the compiler would know.
Thanks for your help.