Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Bug in CExtEditBox read-only in 2.83 Collapse All
Subject Author Date
Offer Har Jun 19, 2008 - 12:35 PM

When you call m_edt.EnableWindow(FALSE); in 2.83, the text is gray on gray:



I zoomed it so you’ll see that there is text there:



Please fix.

Technical Support Jul 2, 2008 - 6:03 AM

Unfortunately the text in disabled controls is always gray. Athough we process the CTLCOLOR_STATIC message to change the text color, this does not work unless the control is enabled. It seems this is a OS’s bug. As a workaround you can make the edit control READONLY rather than DISABLED.

Offer Har Jul 7, 2008 - 6:49 AM

Please fix...

Technical Support Jul 8, 2008 - 6:03 AM

As we mentioned it in our previous message this bug has nothing to do with Prof-UIS. The disabled text color cannot be changed. You can try making the edit background color’s lighter.

Offer Har Jul 8, 2008 - 6:14 AM

Dear Support,


When you disable a text box in a normal MFC application you can read the text Please look below (I’m sure you see the Ron text there...):



But when you do it in a Prof-UIS you cannot see the ’Ron’ text, as I already explained and sent screen-shots above.


THIS HAS NOTHING TO DO WITH WINDOWS - it has to do with the color schene you chose that makes read-only text seems invisible.


Please fix - this is a bug in Prof-UIS

Technical Support Jul 12, 2008 - 9:46 AM

Please update the source code for the CExtEditBase::CtlColor() method. After this update, disabled edit box background will become lighter and text will be visible well:

HBRUSH CExtEditBase::CtlColor( CDC* pDC, UINT nCtlColor )
{
            ASSERT_VALID( this );
            if(                      nCtlColor == CTLCOLOR_EDIT 
                        ||           nCtlColor == CTLCOLOR_MSGBOX
                        ||           nCtlColor == CTLCOLOR_STATIC
                        )
            {
                        bool bReadOnly = (GetStyle()&ES_READONLY) != 0;
                        bool bDisabled = OnQueryWindowEnabledState() ? false : true;
                        COLORREF clrText = GetTextColor();
                        if( clrText == COLORREF(-1L) )
                        {
                                    COLORREF clrSysText =
                                                PmBridge_GetPM()->GetColor(
                                                            bDisabled 
                                                                        ? CExtPaintManager::CLR_TEXT_DISABLED 
                                                                        : COLOR_WINDOWTEXT,
                                                            this
                                                            );
                                    clrText = clrSysText;
                        }
                        COLORREF clrBk = GetBkColor();
                        if( clrBk == COLORREF(-1L) )
                        {
                                    COLORREF clrSysBk =
                                                PmBridge_GetPM()->GetColor( 
                                                            ( bReadOnly || bDisabled ) 
                                                                        ? CExtPaintManager::CLR_3DFACE_OUT
                                                                        : COLOR_WINDOW,
                                                            this 
                                                            );
                                    clrBk = clrSysBk;
                        }
                        pDC->SetBkColor( clrBk );
                        pDC->SetTextColor( clrText );
                        if( m_clrBackPrev != clrBk )
                        {
                                    if( m_brBack.GetSafeHandle() != NULL )
                                                m_brBack.DeleteObject();
                                    m_brBack.CreateSolidBrush( clrBk );
                                    m_clrBackPrev = clrBk;
                        }
                        return m_brBack;
            }
            else
                        return (HBRUSH)Default();
}

Offer Har Jul 8, 2008 - 6:20 AM

P.S. Just to make sure, this is the code I added to a default dialog-based MFC application to make dialog:


1) Added an edit control IDC_EDIT1 to the main dialog resource.


2) Added a member:  CEdit m_edt;


3) Added DXX support to it: DDX_Control(pDX, IDC_EDIT1, m_edt);


4) Added these two lines in OnInitDialog:



   m_edt.SetWindowText(L"Ron");
   m_edt.EnableWindow(FALSE);

Very simple

Offer Har Jul 2, 2008 - 6:08 AM

Hi,


I cannot use the READONLY, because I have a generic algorithm that disables all controls in a dialog regardless of their type.


In previous versions this did work, and I did not do any changes to my OS...


It was always black on gray, so how come it is not gray on gray?


Please advise how can this be solved - isn’t there a way for me to set in the theme thet color of the text when disabled? or the back-ground of the control? there must be a way to fix this problem.


Ron.