|
|
#1 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
Issue with SetCtlColors
This is probably just me, but SetCtlColors doesn't seem to work properly anymore (unless this has always been a problem).
I'm trying to set the colour of a control on an InstallOptions page in the page's Leave function. Everything else works (like EnableWindow and SendMessage) but if I try using SetCtlColors on it, nothing happens. This may also explain why someone in another recent topic couldn't get SetCtlColors to work on one of the 111 dialog labels (Banner). This is the script (it's an example script I'm making for someone... I'm sure you can guess who )-Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#2 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,336
|
SetCtlColors doesn't update the control, you have to do that manually using UpdateWindow, RedrawWindow or some other Windows API.
SetCtlColors doesn't work on 111, because 111 doesn't support it. NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Feb 2005
Location: Italy
Posts: 42
|
msjournal
not sure this MS journal article may help (it's quite old).
http://www.microsoft.com/msj/archive/S1DCC.aspx and this (better): http://www.developeriq.com/articles/...p?id=186&cid=1 Found searching "WM_CTLCOLOR problem". Abstract: ..."In Windows, there are no simple properties for setting the foreground and background colors of an edit control (or any other dialog control). In Visual Basic, you can simply write, Edit1.BackColor = Yellow Edit1.ForeColor = Red but behind the scenes, Visual Basic goes through a lot of rigamarole to make this work. The mechanics for setting the color of a Windows control require handling the special message WM_CTLCOLOR, which Windows sends when it's about to paint a control. I won't go into a detailed explanation here, as this topic is covered in the Win32" documentation for WM_CTLCOLOR and numerous articles in MSDN (including some of my own, probably). I'll just give you the quick recap for edit controls. To set the color of an edit control, you must first handle WM_CTLCOLOR and check for the code CTLCOLOR_EDIT, in which case you must return the brush you want to use for the background. Second, you must call SetBkColor and SetTextColor on the HDC that Windows passes as part of the WM_CTLCOLOR message. If you think all this is strange, you're in good company...." |
|
|
|
|
|
#4 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
Right thanks guys. I remember you already mentioned that kichik when I had the same problem a while ago (just had forgotten!)
Can anyone show me how to call UpdateWindow in the right way? I've found that hiding the label and showing it again seems to update it too, but it seems a bit cheap (but then again, you don't need to use the System plugin). -Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#5 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
I've found a small bug which I felt could go in here rather than create a new topic.
If you do: FindFirst $R0 $R1 "$EXEDIR\*.tx" and say you've got files with .txt entension, those files are found! Is this a bug? -Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Dec 2004
Location: Turkey
Posts: 447
|
Hi Afro UK, the subject above really should go somewere else
I almost missed the trick of hiding and unhiding to redraw the labels. I have(had?) problems if I make the labels transparent and move to the previous screen, the lables do not refresh correcly, this tip just might solve my problem, will try and report back with a full example.
"Just do it" |
|
|
|
|
|
#7 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
Righto, I'll put an archive page up.
I'll check that bug again and submit a bug report. -Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#8 | |
|
Major Dude
Join Date: May 2003
Posts: 676
|
Quote:
i have similar issue here in a leave function - unless i define a background color, but this will probably only here with standard colors - "transparent" leaves always a shadow and i cannot turn off for 100% text with empty text. |
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|