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 » CExtEdit Backk color problem Collapse All
Subject Author Date
Offer Har Aug 13, 2011 - 10:27 PM

Dear Support,


I want to change the back color of a text edit for a certain time, and after it return it to its original color. What I did was to store the previous color, set it a the temp, and after the timeout, return to the previous color I saved (which was supposed to be the original)


The problem is that it did not return to its original color. The reason is that when I call the function GetBkColor it does not return me the color, but -1.


This there a way to force it to return me the real color, and not -1? or is there a function to force it to return to its original back color?


Thanks,


Ron.

Technical Support Aug 15, 2011 - 7:29 AM

The pExtEdit->SetBkColor( COLORREF(-1L) ); code returns the default background color of the editor control:

void CExtEditBase::SetBkColor( COLORREF clrBk )
{ 
    ASSERT_VALID( this );
    m_clrBack = clrBk; 
    if( GetSafeHwnd() != NULL )
        RedrawWindow( NULL, NULL, RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_ERASENOW|RDW_FRAME |RDW_FRAME|RDW_ALLCHILDREN );
}
Please check that your dialog or CExtEdit-derived classes does not handle the WM_CTLCOLOR messages for re-coloring the edit control.

Offer Har Aug 17, 2011 - 12:36 AM

Thanks. solved the problem.

Technical Support Aug 14, 2011 - 9:25 AM

The COLORREF(-1L) color value means there is no background color assigned to an edit control and the current theme appearance should be used. The default color is not a color but rather the visual appearance provided by Windows. Some future Windows version may have the paint editor background as a gradient or a bitmap based skin.

Offer Har Aug 14, 2011 - 11:45 AM

So how can I roll back to the original color of the control?... if I call SetBkColor with -1 it does nothing...


Thanks.