Archive: SetCtlColors and button text color


SetCtlColors and button text color
  NSIS manual says that "SetCtlColors Sets a background color and the text color for a static control, edit control, button or a dialog." But I couldn't change the text color of buttons to white using it. Any ideas excluding wansis plugin?


No I can't get it to work either!

-Stu


Buttons text color
  I tried it too, but no success
Maybe I am doing something wrong?


!define BUTTONS_TEXT_COLOR "0xFFFFFF"

FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $HWNDPARENT 1
SetCtlColors $0 ${BUTTONS_TEXT_COLOR} transparent GetDlgItem $0 $HWNDPARENT 2
SetCtlColors $0 ${BUTTONS_TEXT_COLOR} transparent GetDlgItem $0 $HWNDPARENT 3
SetCtlColors $0 ${BUTTONS_TEXT_COLOR} transparent


This code works with labels, but with buttons no!

You can't use variables for the colors. You would need to do something like this:


FindWindow $0 "#32770" "" $HWNDPARENT

GetDlgItem$0 $HWNDPARENT 1
SetCtlColors$0 0xFFFFFF transparent
GetDlgItem$0 $HWNDPARENT 2
SetCtlColors$0 0xFFFFFF transparent
GetDlgItem$0 $HWNDPARENT 3
SetCtlColors$0 0xFFFFFF transparent
>
A feature request has been made for it but no progress yet.
https://sourceforge.net/tracker/inde...49&atid=373088

T.Slappy wasn't using variables. He was using a compile time constant.

It doesn't work due to issues with Windows XP styles. If you don't use XPStyle on then it should work (you may still need to refresh the static control though).

-Stu


AFAIK there is no way to skin a button. Using the compile-time constants is fine (I do it all the time in the ExperienceUI) but I have never been able to get buttons to work with SetCtlColors. The SkinnedButton plugin has worked pretty well in my tests, but I haven't messed with it in over a year, and as far as I can remember it requires you to explicitly specify XPStyle off if you are using the Modern UI.

Also, I know this is totally off topic, but I need to announce this somewhere: my old e-mail address dandaman32@isp.com will cease to exist as of this coming Monday, as I am finally biting the bullet and getting DSL, thus involving a switch to another ISP. My new e-mail address, which I have been using all summer, is <my screen name> AT gmail <dot> com.

-dandaman32


Originally posted by dandaman32

Also, I know this is totally off topic, but I need to announce this somewhere: my old e-mail address dandaman32@isp.com will cease to exist as of this coming Monday, as I am finally biting the bullet and getting DSL, thus involving a switch to another ISP. My new e-mail address, which I have been using all summer, is <my screen name> AT gmail <dot> com.

-dandaman32
Maybe you should make the switch to 64 bit aswell :D

buttons
  I set XPStyle off, beacuse I use skinnedbutton plugin.

I want to have full skin in my installer (I wrote my own script and publish it in another topic), but when I use dark bitmaps for buttons (see attachment) buttons texts cannot be read.

Upper code works fine with labels...


Originally posted by Anders
Maybe you should make the switch to 64 bit aswell :D
well i just finished downloading openSuSE 10.1 final x86 edition, and i already wasted a DVD on it, so i'm stuck with x86 for now ;) don't feel like downloading that gigantic ISO again :rolleyes: besides NSIS doesn't have 64bit support yet so why bother? :p

Slappy - my guess for coloring button text would be to call SetCtlColors and then send the control WM_REDRAW or something, though I have no experience with C or anything with the Win32 API for that matter so I don't know. I think kichik wrote that doc page so he's probably the one you should ask.

-dandaman32

Re: buttons
 

Originally posted by T.Slappy I want to have full skin in my installer (I wrote my own script and publish it in another topic), but when I use dark bitmaps for buttons (see attachment) buttons texts cannot be read.
The next version of the SkinnebButton plugin will implement this feature.

I develop also an other plugin named SkinnedControls that can skin Buttons AND/OR ScrollBars.

I will release these plugins soon at the same time as UltraModernUI beta2.

And I try to make so that the next and back buttons skin then even after having used the startmenu plugin, but I do not arrive to fix it.

It would be possible to modify 2 lines in the file ui.c?
The lines 98 and 553, where a button gets set to BS_PUSHBUTTON resp. BS_DEFPUSHBUTTON, it voids the flag BS_OWNERDRAW that is mandatory for skinned buttons.
Can your modify BS_PUSHBUTTON and BS_DEFPUSHBUTTON by the BS_OWNERDRAW in this file for the next NSIS version since that does not influence the unskinned installers?

An other change is to editing the GUI exe, dialog 106, resource ID 1027 ("Show Details" button) where we must replace BS_PUSHBUTTON by BS_OWNERDRAW again to keep this button skinned.

This 3 changes make SkinnedButton, SkinnedControls and Wansis work better...

I think you should post a feature request on the NSIS Source Forge page.

-Stu


OK I will do that