Old 2nd January 2006, 17:33   #1
stb
Senior Member
 
Join Date: Mar 2004
Location: Germany, Paderborn
Posts: 177
Bug with MUI, WinXP Luna and SetCtlColors?

I have a problem with WinXP, Luna, NSIS 2.12, ModernUI. I added some custom controls to welcome page and changed the background to transparent in custom show function using setCtlColors. This does not work correct with Luna (modern WinXP Gui).

The following code works with WinXP Luna AND classic:

code:

Function showWelcomePage
Push $0
GetDlgItem $0 $MUI_HWND 1203
SetCtlColors $0 "000080" "${MUI_BGCOLOR}"
GetDlgItem $0 $MUI_HWND 1204
SetCtlColors $0 "" "${MUI_BGCOLOR}"
Pop $0
FunctionEnd



The following code works only with classic. The last ctl (highest ID) will get black background (unreadable). This occurs directly after starting the Installer. Similar problem with uninstaller welcome page.

code:

Function showWelcomePage
Push $0
GetDlgItem $0 $MUI_HWND 1203
SetCtlColors $0 "000080" "transparent"
GetDlgItem $0 $MUI_HWND 1204
SetCtlColors $0 "" "transparent"
Pop $0
FunctionEnd



Of course those controls get added in preWelcomePage. 1204 is a checkbox and 1203 is a web link.

ioSpecial.ini

code:

[Settings]
Rect=1044
NumFields=5
RTL=0
NextButtonText=
CancelEnabled=
[Field 1]
Type=bitmap
Left=0
Right=109
Top=0
Bottom=193
Flags=RESIZETOFIT
Text=C:\Temp\nstB0.tmp\modern-wizard.bmp
HWND=1704972
[Field 2]
Type=label
Left=120
Right=315
Top=10
Text=Welcome...
Bottom=38
HWND=853212
[Field 3]
Type=label
Left=120
Right=315
Top=45
Bottom=140
Text=bla bla
HWND=853208
[Field 4]
Type=Link
Left=120
Right=315
Top=175
Bottom=185
State=http://nsis.sf.net
Text=Web page
HWND=1508514
[Field 5]
Type=Checkbox
Text=Express-Installation
Flags=NOTIFY
State=0
Left=120
Right=315
Top=145
Bottom=155
HWND=787520

stb is offline   Reply With Quote
Old 3rd January 2006, 18:17   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
How did you get it to show up in classic? The only difference I can think of between MUI and classic is that the MUI sets the background of the entire dialog to white. In the MUI, setting the background back to nothing still showed up the check box as black.

Anyway, back to the original issue, I think I saw it once. I think it's a problem with the BUTTON class lack of support for transparent backgrounds. It probably has something to do with this quote from MSDN's page about WM_CTLCOLORBTN:
Quote:
However, only owner-drawn buttons respond to the parent window processing this message.
NSIS itself doesn't handle SetCtlColors differently for different window classes.

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 4th January 2006, 08:02   #3
stb
Senior Member
 
Join Date: Mar 2004
Location: Germany, Paderborn
Posts: 177
Sorry, I did mean "Windows GUI classic mode" (Windows XP user style "classic" which is similar to Win2000 GUI).

So: WinXP classic style works correct, Luna NOT. Same installer.

What is quite weird: My welcome page has two custom controls. In the code above always the last (highest ID, 1204) control is black, it is always a checkbox. I'm quite sure I had also both controls black during my experiments, probably due to not changing the foreground color of the link control (1203).
stb is offline   Reply With Quote
Old 31st January 2006, 17:29   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
A checkbox also uses the BUTTON window class, so I don't think it has anything to do with their order.

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 31st January 2006, 17:56   #5
stb
Senior Member
 
Join Date: Mar 2004
Location: Germany, Paderborn
Posts: 177
Maybe it is the fact that 1204 is the last control in ioSpecial.ini
stb is offline   Reply With Quote
Old 31st January 2006, 18:03   #6
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Can you attach a complete example? I don't want to create it again.

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 31st January 2006, 18:23   #7
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Never mind, created one on my own. I've added another checkbox, set its background to transparent and both of them were black. I've also tried changing their field numbers to 1 and 2, still black. It's not related to its location in the INI file.

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 31st January 2006, 18:29   #8
stb
Senior Member
 
Join Date: Mar 2004
Location: Germany, Paderborn
Posts: 177
Sorry. I don't have a full script for this one. (funny order :-))
stb is offline   Reply With Quote
Old 31st January 2006, 18:31   #9
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Why not use ${MUI_BGCOLOR}?

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 31st January 2006, 18:39   #10
stb
Senior Member
 
Join Date: Mar 2004
Location: Germany, Paderborn
Posts: 177
In fact, I do (now). So the issue is somewhat academic. But it is not "transparent". If it is not working correctly, "transparent" should be removed (at least from NSIS help) or this issue should be mentioned. I never noticed this quite some time because I use classic Windows GUI.
stb is offline   Reply With Quote
Old 31st January 2006, 18:45   #11
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
The "transparent" switch is working. It only fails for check boxes on XP for some weird unknown reason which seems to be unrelated to NSIS. I've tried some other applications, and they all exhibit this behavior.

I'll update the help file.

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 1st February 2006, 11:26   #12
onad
Senior Member
 
onad's Avatar
 
Join Date: Dec 2004
Location: Turkey
Posts: 447
If one really want to solve it, there is always the hard way

IDEA:

1)Get position x,y, h,w of Checkbox text. (x = Full + Checkbox width)
2)Create a memorybitmap and copy the background for moriginal background source to this canvas
3) Write the text on the memorybitmap canvas
4) Copy the memorybitmap to the dialogcanvas on the correct position.

Just an idea, I know it is a lot of work, but that is sometimes the case with developing...

"Just do it"
onad is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast 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