Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 24th September 2006, 20:15   #1
MidnightJava
Junior Member
 
Join Date: Sep 2006
Location: Springfield, Virginia, USA
Posts: 45
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?

-Mark
MidnightJava is offline   Reply With Quote
Old 24th September 2006, 22:10   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 25th September 2006, 00:30   #3
MidnightJava
Junior Member
 
Join Date: Sep 2006
Location: Springfield, Virginia, USA
Posts: 45
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.

-Mark
MidnightJava is offline   Reply With Quote
Old 29th September 2006, 09:38   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
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.
code:
!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


NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 10th October 2006, 00:35   #5
MidnightJava
Junior Member
 
Join Date: Sep 2006
Location: Springfield, Virginia, USA
Posts: 45
Thanks, kichik. Just got around to trying this, and it does exactly what I need.

-Mark
MidnightJava is offline   Reply With Quote
Old 15th June 2007, 03:35   #6
MidnightJava
Junior Member
 
Join Date: Sep 2006
Location: Springfield, Virginia, USA
Posts: 45
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?

-Mark
MidnightJava is offline   Reply With Quote
Old 15th June 2007, 04:27   #7
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,784
Are you getting compiler errors? If so, make a copy of that function and rename it un.compShow

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 15th June 2007, 04:39   #8
MidnightJava
Junior Member
 
Join Date: Sep 2006
Location: Springfield, Virginia, USA
Posts: 45
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

-Mark
MidnightJava is offline   Reply With Quote
Old 15th June 2007, 04:55   #9
MidnightJava
Junior Member
 
Join Date: Sep 2006
Location: Springfield, Virginia, USA
Posts: 45
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.

-Mark
MidnightJava is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump