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 General Discussion » How to invalidate a grid (CExtGridWnd) Collapse All
Subject Author Date
mai mike Jul 9, 2008 - 11:38 PM

Dear Technical team,


I have a problem want to ask for you help.


I have created a grid(CExtGridWnd), Sometimes, i need to invalidate or disable this grid.


It mean that the user can’t do any operation on it. And the purpose I want it this disabled grid look like as


the pop-up menu item which is disabled., and I hope the icon or bitmap on this grid are still keep its color, not gray.


I have use CWnd:EnableWindow(BOOL bEnable) to implement it. but the result is not I expect..


How can I do it?


Thank you in advance!


Best regards,


Mike Mai


 

mai mike Jul 13, 2008 - 8:35 AM

Dear Technical team,


I have used the function you metioned, but the result wasn’t I expect.


The background isn’t write, and the color of icons or bitmaps and texts on it don’t changed.


I want the colors or icons or bitmaps, texts and the line of grid can be more lighted.


Can it do that?


Thank you in advance.


Best regards,


Mike Mai

Technical Support Jul 13, 2008 - 9:38 AM

Disabled look of the grid control which you request is typically supported by simple UI items like button controls and never supported by list views, tree views and grid windows. Small button controls inserted into dialog window require different look of text and icon to let user recognize them as disabled UI items. Big controls like multiline editors, trees, lists and grids does not require such very different look in disabled state. The edit controls in disabled or read-only state have different background which is similar to that we advised you in our previous answer. Lists, trees and grids typically have exactly the same look in normal, disabled and read-only modes.

Technical Support Jul 10, 2008 - 1:46 PM

Some controls have a different look for the disabled state but some don not. The CExtGridWnd class and the classes derived from it have exactly the same look in both enabled and disabled states. You can override the following virtual method in your CExtGridWnd-derived class to make tje grid control looking different for the disabled state:

void CYourGridWnd::OnGbwEraseArea( CDC & dc, const RECT & rcArea, DWORD dwAreaFlags ) const
{
      ASSERT_VALID( this );
      ASSERT( dc.GetSafeHdc() != NULL );
      if(         ( dwAreaFlags & __EGBWA_INNER_CELLS ) != 0
            &&    ( ! IsWindowEnabled() )
            )
      {
            dc.FillRect( & rcArea, &( OnSiwGetLighterOrDarkerBrush( 1 ) ) );
            return;
      }
      CExtGridWnd::OnGbwEraseArea( dc, rcArea, dwAreaFlags );
}
The method above paints the background of inner data cell area of the disabled grid window with an alternative color.