Hi,
i ve seached around, and i have found a few similar threads.
so, is it possible to change that gray font color that windows gives to my disabled, read-only, edit box?
what i have so far is :
.elseif uMsg == WM_CTLCOLORSTATIC
invoke GetWindowLong,lParam,GWL_ID
.if eax == 503 ; My edit?
invoke GetStockObject, WHITE_BRUSH
ret
.endif
i have tried : Invoke SetTextColor,wParam,0FFh ; something
and it doesnt seem to work .
any suggestions?
i ve seached around, and i have found a few similar threads.
so, is it possible to change that gray font color that windows gives to my disabled, read-only, edit box?
what i have so far is :
.elseif uMsg == WM_CTLCOLORSTATIC
invoke GetWindowLong,lParam,GWL_ID
.if eax == 503 ; My edit?
invoke GetStockObject, WHITE_BRUSH
ret
.endif
i have tried : Invoke SetTextColor,wParam,0FFh ; something
and it doesnt seem to work .
any suggestions?
.elseif uMsg == WM_CTLCOLORSTATIC
invoke SetBkColor, wParam, MyColor
invoke SetBkColor, wParam, MyColor
.elseif uMsg == WM_CTLCOLORSTATIC
invoke SetBkColor, wParam, MyColor
micmic,
The above will change the BackGround color not the Font color.
Katalaves?
Hi
Perhaps my attachment can be of help.
Perhaps my attachment can be of help.
Sorry, I was reading too fast :)
I guess you mean the COLOR_GRAYTEXT font, which is used after version 4.0 for disabled edit controls. The easiest way is to avoid disabling the edit control altogether, and instead change its style and make it read-only. Of course, you can subclass it, check whether it's enabled or not, process WM_PAINT messages and draw the text yourself...
I guess you mean the COLOR_GRAYTEXT font, which is used after version 4.0 for disabled edit controls. The easiest way is to avoid disabling the edit control altogether, and instead change its style and make it read-only. Of course, you can subclass it, check whether it's enabled or not, process WM_PAINT messages and draw the text yourself...
Heh, you are all wrong so far ;)
For an edit box, you need the WM_CTLCOLOREDIT message, not WM_CTLCOLORSTATIC.
And if i may quote MSDN:
So, you might have to follow micmic's idea, and not actually disable the control.
For an edit box, you need the WM_CTLCOLOREDIT message, not WM_CTLCOLORSTATIC.
And if i may quote MSDN:
An edit control that is not read-only or disabled sends the WM_CTLCOLOREDIT message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the edit control.
So, you might have to follow micmic's idea, and not actually disable the control.
sluggy,
but my edit box IS disabled, therefore if i read correctly, the WM_CTLCOLOREDIT will not be sent! instead WM_CTLCOLORSTATIC will be sent!
i dont see where i am wrong here :rolleyes:
I havent fount a way to change the disabled-gray-text-color...i will leave subclassing last!
but my edit box IS disabled, therefore if i read correctly, the WM_CTLCOLOREDIT will not be sent! instead WM_CTLCOLORSTATIC will be sent!
i dont see where i am wrong here :rolleyes:
I havent fount a way to change the disabled-gray-text-color...i will leave subclassing last!
You could do other things too, which I'm too lazy to explore in depth: Like using SetSysColors to change the default color for COLOR_GRAYTEXT, and then restore it again when your program exits. This would have the effect of changing disabled text color in any other open windows, unless you find a way to block all WM_SYSCOLORCHANGE messages sent ... Or perhaps you could hook the API used to draw the text on the disabled control (ExtTextOut ?) and change the text color before Windows has a chance to change it again... Or you could destroy the caret of a read-only edit control so that it looks exactly like a disabled one... The point is that there is no "official" way of doing it.
Maybe you should use the forum search feature: IIRC it already was discussed before...
therefore if i read correctly, the WM_CTLCOLOREDIT will not be sent! instead WM_CTLCOLORSTATIC will be sent!
I read the article a bit further, and you are right. However, it looks like you cannot change from the default even though you are trapping the correct message (some of these things are not spelled out in the doco, you just have to find them out for yourself). I would suggest that you check micmic's suggestions, but i would recommend NOT changing the default system colors, that is something the user does and an app shouldn't.minor28,
Thanks for your code! It worked with some edit boxs I had set with ES_READONLY
I used the same dialog code for a data entry and view functions.
Thanks,
farrier
Thanks for your code! It worked with some edit boxs I had set with ES_READONLY
I used the same dialog code for a data entry and view functions.
Thanks,
farrier
Radiosys,
as i mentioned in my first post, what was discussed before was about a read-only edit box not a disabled one.
slugy, micmic, thanks for your input. i ll check em out when i get some free time..
as i mentioned in my first post, what was discussed before was about a read-only edit box not a disabled one.
slugy, micmic, thanks for your input. i ll check em out when i get some free time..