|
|
|
|
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.
Subject |
Author |
Date |
|
Damien Castelltort
|
Sep 28, 2006 - 9:16 AM
|
Hi,
I have a problem using CExtPropertyGridCtrl component. We are using the version 2.54. I overloaded this class (let s call it PROPERTY_EDITOR) to allow me to instanciate my overloads of the CExtPropertyValue class (let s call it PROPERTY_VALUE).
I added two methods in the PROPERTY_EDITOR class :
SynchronizeFromObject() :
This method synchronizes the cell values from my object values. In this method, I make a call to the PropertyStoreSynchronize() method to update the cell content.
SynchronizeFromGUI() :
This method synchronizes my object values from the cell values. At the end of this method, I call the SynchronizeFromObject() method to refresh all the properties because some of my object values can be related to each other, it means that if I can edit properties A , B , C in the grid, changing value of property A can alter the values of the B and C properties. This method is called in the PROPERTY_VALUE :: Apply() method.
Let s take the example of a CExtGridVariantCell. The issue is that each time i modify the value of the cell using the spinbuttons, the SynchronizeFromGUI method is called, that calls to the SynchronizeFromObject method that performs a PropertyStoreSynchronize() method call. Thus i loose the focus on the edited cell.
Do you have a solution to Update the cells content without using the PropertyStoreSynchronize method
Best Regards
|
|
Technical Support
|
Sep 28, 2006 - 11:16 AM
|
You can get the array of tree grid windows in the property grid control and find grid cells of a particular property value in all the grids: CExtPropertyValue * pPropertyValue = . . .
CExtPropertyGridCtrl & _PGC = . . .
CTypedPtrArray < CPtrArray, CExtPropertyGridWnd * > arrGrids;
_PGC.OnPgcQueryGrids( arrGrids );
INT nGridIdx = 0, nGridCount = INT( arrGrids.GetSize() );
for( ; nGridIdx < nGridCount; nGridIdx ++ )
{
CExtPropertyGridWnd * pGrid = arrGrids[ nGridIdx ];
ASSERT_VALID( pGrid );
HTREEITEM hTreeItem = pGrid->PropertyItemToTreeItem( pPropertyValue );
if( hTreeItem == NULL )
continue;
CExtGridCell * pGridCell = pGrid->ItemGetCell( hTreeItem, 1 );
if( pGridCell == NULL )
continue;
ASSERT_VALID( pGridCell );
//
// modify pGridCell here and then redraw it if it is visible:
//
LONG nRowNo = pGrid->ItemGetVisibleIndexOf( hTreeItem );
if( nRowNo < 0 )
continue;
CRect rc;
if( pGrid->GridCellRectsGet( 1, nRowNo, 0, 0, NULL, &rc ) )
{
CRect rcClient;
pGrid->GetClientRect( &rcClient );
rc.left = rcClient.left;
rc.right = rcClient.right;
pGrid->InvalidateRect( &rc );
}
}
|
|