Sign in to follow this  
Followers 0
ame1011

Possible to change the text color of a disabled edit?

6 posts in this topic

Is this possible? A search yielded no results.


[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]

Share this post


Link to post
Share on other sites



GUICtrlSetBkColor()

GUICtrlSetColor()

....

Share this post


Link to post
Share on other sites

GUICtrlSetBkColor() works to set the BK color of the control and I've already done that.

What I want is to change the grey font to a pure black in a disabled control, which GUICtrlSetColor() doesn't accomplish.


[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Does the edit control have to be disabled?

You can use $ES_READONLY style.

Otherwise might as well just use label control instead.

Edited by Siao

"be smart, drink your wine"

Share this post


Link to post
Share on other sites

Yeah I Need it to be disabled =/. Readonly allows mouse clicks and selects the text inside the box if there is text, something I cannot have. I want my inputbox to have the exact same functionality as a disabled control but with pure black text. Any Ideas?


[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Problem with disabled edit is that for whatever reason M$ decided to hardcode the color of text to use system COLOR_GRAYTEXT, so it's not possible to set the text color using WM_CTLCOLOREDIT/WM_CTLCOLORSTATIC for disabled, even though it works fine for enabled/readonly, and even though setting background color via these messages works just fine in all cases. Not that surprising I guess, Microsoft have a history of doing things in ways that don't make sense. Point is, this makes what you want rather complicated to do. In any case, it would require subclassing edit control, and either do the painting yourself on a disabled, or use readonly style like I suggested and simply intercept mouse/focus messages to prevent user clicking/selecting...

So, like I said, consider using different control. Label, or if you have lot of information to show and need scrolling, a listbox with $LBS_NOSEL style... although seeing as you want to use disabled edit, which doesn't have scrolling ability, I guess that's not the case. So like I said, why simple label is not enough?

Edited by Siao

"be smart, drink your wine"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0