I would like to change to another color the resulting gray background color of edit boxes when I set to yes to the "Highlight on focus property" of edit controls, is it possible to do that?. I did not found some property in fields, edit or panel properties to get that. It seems that change of Winwidgets or MFC settings in the INI runtime file does not make any difference.
mfc c++ - MFC: How do I change the background color of the whole editBox? - Stack Overflow
and winwidgets see HiliteBrush Attribute
SetWindowTheme function (Windows)
Might do the trick for a whole panel but still searching how to set this for an application or at least what setting in Windows OS allows you to change the default colour 'COLOR_GRAYTEXT'
SetSysColors function (Windows)
This would help for All desktop applications but not just yours....
really does not seem to be an easy setting but to forced to code for panel/control
How to change the background color of an MFC edit control
Basically have never done this and I think winwidgets had this functionality but MFC not so CA have built it into the runtime when the control are MFC
Will have a play after this research and see what works and what does not when time allows
In the meantime could you tell me the syntax for the VBX option in your first answer: [form. ] [control. ] HiliteColor [= color]. Are the form and control optionals ?. color must be something like blue or black ?. I've downloaded the Winwidgets Help from the WikiPlex but there are some problems in opening it because of the old help file format.
By the way, I am using the Winwidgets settings and not planning to use MFC.
I forgot i created this and I found it using Search Large Properties - Stella Tools (CA Plex Developer Tools) while looking for an example fro you
I knew this topic seemed familiar...lots of source in Downloads - Stella Tools (CA Plex Developer Tools)
// The color or pattern used to paint the background when the control receives focus
hbrNewHilite = CreateSolidBrush(RGB(200,200,8));
SendMessage(hWndEditControl, HEM_SETHILITEBRUSH, (WPARAM)hbrNewHilite, 0L);
I was trying to use SetProperty API to set the background color of Edit controls but it doesn't look like it's supported (I could get other properties working), so I ran across this post. I have tried the source code but it doesn't seem to work for me, maybe I am missing something... I know this has been a while, but just wondering if you remember this was working, I went through the Stella Tools documentation but did not find anything related to this, would you please shed some light?
Thanks for your time!
you can not do it with SetProperty API.
You can not do it with MFC
the only way you can do it is for our original winwidgets and that source worked for me remembering to set the ini file settings to be winwidget and not mfc, remember you can also restrict the windget to a type of control and you can alos just do it on a panel basis, for example your application is to use mfc which is what I would advise, but on one panel and one particular control type you want to use winwidget can all be set in the ini file.
NOTHING WILL HAPPEN IF YOU DO NOT SET - HIGHLIGHT ON FOCUS - control panel
it works plex 7.2 for me
Thanks George! I appreciate your response on this.
OK, we did not set the 'Highlight on Focus' property to Yes, after making the change, it seems to be working on the first load of the panel, but when I try to trigger it with a button, the same code doesn't seem to work, which is strange.
Actually we are trying to use the source code to set the background color of edit controls regardless if the control has focus or not, so I changed the code to use 'HM_SETBKGNDBRUSH' and this seems to work the opposite to 'HEM_SETHILITEBRUSH', it doesn't work when the panel is initialized, but it does when I trigger it from a button event.
For what we need, I set the 'Highlight on Focus' back to No, and used 'HM_SETBKGNDBRUSH', it works correctly for both panel initialization and event trigger.
Once again, thank you for your help, George, and Happy New Year to you and yours!!
I did find an issue that when the Background Color of the edit control is set (in the panel designer), this doesn't seem to work, it only works when it has 'No Value'. Maybe need some kind of 'erase background color' first?
maybe you have do redraw see Function: StellaTools.Abstract.UIBASIC.RedrawPanel.API.WinC
I tried that, it doesn't seem to help, it looks like whatever is set in the panel designer is overriding the API call.