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 » Selecting a CExtPropertyGridCtrl item into view Collapse All
Subject Author Date
Martin Barringer Jun 11, 2009 - 9:53 AM

When adding items to my CExtPropertyGridCtrl the control scrolls to about the mid area of my items when complete.  I’d like for it to scroll to the top of my grid so the first item is visible.  But I don’t see a way of accomplishing this.  Does anyone know how select an item into view?

Technical Support Jun 11, 2009 - 12:39 PM

Please run the PropertyGrid sample. The Selected stars property store should be selected in the combo box at the top of the property grid control. You can scroll the tree grid part of the property grid control vertically to non-topmost some position. Then you can check/uncheck some of star buttons. As a result, the displayed property store will be reinitialized and reassigned to the property grid control. The scroll position will jump to the top. So, it would be interesting to know what your application does with the property grid control to make it scrolling vertically.

In any case, it’s possible to scroll all the tree grid windows inside the property grid control to the top programmatically. Your property grid modification code should look like:

CExtPropertyGridCtrl & _PGC = . . .
      _PGC.SetRedraw( FALSE );
      //
      // TO-DO: change your property store(s) here,
      //        invoke the _PGC.PropertyStoreSynchronize(); code finally
      //
      CTypedPtrArray < CPtrArray, CExtPropertyGridWnd * > arrGrids;
      _PGC.OnPgcQueryGrids( arrGrids );
      INT nGridIdx;
      for( nGridIdx = 0; nGridIdx < arrGrids.GetSize(); nGridIdx ++ )
      {
            CExtPropertyGridWnd * pGrid = arrGrids[ nGridIdx ];
            ASSERT_VALID( pGrid );
            pGrid->OnSwSetScrollPos( CPoint( 0, 0 ) );
      }
      _PGC.SetRedraw( TRUE );
      _PGC.RedrawWindow( NULL, NULL, RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN );