Plex 2E

Expand all | Collapse all

Is it possible to change the background color for "Highlight on focus" edit property?

  • 1.  Is it possible to change the background color for "Highlight on focus" edit property?

    Posted May 26, 2015 09:05 PM

    Hello,


    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. 


    Thank you.



  • 2.  Re: Is it possible to change the background color for "Highlight on focus" edit property?
    Best Answer

    Posted May 27, 2015 01:08 PM

    Source options

     

    mfc   c++ - MFC: How do I change the background color of the whole editBox? - Stack Overflow

     

    and winwidgets see HiliteBrush Attribute

    HiliteBrush.png



  • 3.  Re: Is it possible to change the background color for "Highlight on focus" edit property?

    Posted May 27, 2015 01:45 PM

    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'



  • 4.  Re: Is it possible to change the background color for "Highlight on focus" edit property?

    Posted May 27, 2015 01:51 PM

    SetSysColors function (Windows)

     

    This would help for All desktop applications but not just yours....



  • 5.  Re: Is it possible to change the background color for "Highlight on focus" edit property?

    Posted May 27, 2015 01:59 PM

    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



  • 6.  Re: Is it possible to change the background color for "Highlight on focus" edit property?

    Posted May 27, 2015 03:13 PM

    Thanks George,

     

    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.

     

    Thanks again.

     

    Raul



  • 7.  Re: Is it possible to change the background color for "Highlight on focus" edit property?

    Posted May 28, 2015 02:32 AM

    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

    {

    HWND hWndEditControl=ObPanelAPI::GetControlHandleByName(&(1:));

    if (hWndEditControl)

    {

    HBRUSH hbrNewHilite;

    hbrNewHilite = CreateSolidBrush(RGB(200,200,8));

    SendMessage(hWndEditControl, HEM_SETHILITEBRUSH, (WPARAM)hbrNewHilite, 0L);

    }

    }



  • 8.  Re: Is it possible to change the background color for "Highlight on focus" edit property?

    Posted Dec 29, 2017 08:49 AM

    Hi George,

     

    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!

    James



  • 9.  Re: Is it possible to change the background color for "Highlight on focus" edit property?

    Posted Dec 30, 2017 04:40 AM

    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



  • 10.  Re: Is it possible to change the background color for "Highlight on focus" edit property?

    Posted Dec 31, 2017 06:21 PM

    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!!

     

    Best regards,

    James



  • 11.  Re: Is it possible to change the background color for "Highlight on focus" edit property?

    Posted Jan 02, 2018 01:37 PM

    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?

     

    Thanks,

    James



  • 12.  Re: Is it possible to change the background color for "Highlight on focus" edit property?

    Posted Jan 02, 2018 05:21 PM

    maybe you have do redraw see Function: StellaTools.Abstract.UIBASIC.RedrawPanel.API.WinC



  • 13.  Re: Is it possible to change the background color for "Highlight on focus" edit property?

    Posted Jan 02, 2018 06:34 PM

    I tried that, it doesn't seem to help, it looks like whatever is set in the panel designer is overriding the API call.

     

    Thanks,

    James