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 PropertyStoreSyncronizeAll without making disruptions Collapse All
Subject Author Date
Malcolm D Jul 15, 2007 - 6:16 PM

Do you know how to use PropertyStoreSyncronizeAll without it loosing focus to a selected item and scrolling to the top? I need to use PropertyStoreSyncronizeAll mainly because I am using "CanBeInsertedIntoPropertyGrid" to change the visibility of items, without recreating the properties. Are there any other ways around the problem?

Here is a link to a discussion about similar issue with PropertyStoreSyncronizeAll : http://www.prof-uis.com/Forum_View.aspx?CID=29&M=3661
to do with remembering expanded states of categories - which is something I need as well- which does seem to work.

Thanks
Malcolm

Malcolm D Aug 12, 2007 - 6:03 PM

Any response on this one?

Malcolm D Jul 19, 2007 - 10:49 PM

If there is no other way to do this, (I presume you have read the previous posts and understand what I am trying to do - I’m also not sure in what other situations the "CanBeInsertedIntoPropertyGrid" function is meant to be useful)

... then, is there a way to get the current scroll state of the same window, and get the current focus and button state of the selected item and manually reset them after the call to "PropertyStoreSynchroniseAll" ?

Thanks
Malcolm

P.S. A futher explanation of the my usage of CanBeInsertedIntoPropertyGrid: When the value of a propety changes (e.g. with a radio button or a drop down) - there might be other dependand properties which are only applicable depdning on the value of another property. In this case we need to call PropertyStoreSynchroniseAll to chagne their visibility (which is determined by a call to the overloaded CanBeInsertedIntoPropertyGrid). The property control can then show the updated properties.

Malcolm D Jul 18, 2007 - 6:38 PM

Do you have any suggestions to deal with this issue? Either a way to avoid using PropertyStoreSynchroniseAll, or a way to restore the item to its state as best as possible?

Thanks
Malcolm

Malcolm D Jul 16, 2007 - 6:24 PM

The main reason I am calling PropertyStoreSyncronizeAll is that I need to change the visibility of some items via an overloaded "CExtPropertyGridCell::CanBeInsertedIntoPropertyGrid", so in the Apply function I call my own update function for the entire grid which sets the correct visibility of items for the current state, and then call PropertyStoreSynchronizeAll.

The problem is using PropertyStoreSynchronizeAll causes the problems mentioned previously. I was hoping that just changing the visibility of items instead of recreating the all properties everytime might be the way to go, but I still need to use PropertyStoreSynchronizeAll as far as I can tell.

I have some properties which affect the visibility of other items.

Technical Support Jul 16, 2007 - 12:44 PM

When the property tree structure changes, you should use the CExtPropertyGridCtrl::PropertyStoreSynchronizeAll() method. If you change only some property value, you can update only its grid cells stored in the tree grid windows inside the property grid control:

CExtPropertyGridCtrl * pPGC = ...
CExtPropertyValue * pSomePropertyValue = ...
CExtGridCell * pCellSrc = pSomePropertyValue->ValueActiveGet();
// 
// ... modify the data stored in the pCellSrc grid cell ...
//
CTypedPtrArray < CPtrArray, CExtPropertyGridWnd * > arrGrids;
pPGC->OnPgcQueryGrids( arrGrids );
INT nGridIdx;
for( nGridIdx = 0; nGridIdx < arrGrids.GetSize(); nGridIdx ++ )
{
    CExtPropertyGridWnd * pWndTreeGrid = arrGrids[ nGridIdx ];
    ASSERT_VALID( pWndTreeGrid );
    HTREEITEM hTreeItem = pWndTreeGrid->PropertyItemToTreeItem( pSomePropertyValue );
    if( hTreeItem == NULL )
        continue;
    CExtGridCell * pCellDst = pWndTreeGrid->ItemGetCell( hTreeItem, 1 );
    if( pCellDst == NULL )
        continue;
    ASSERT_VALID( pCellDst );
    pCellDst->Assign( *pCellSrc );
    bool bGridIsVisible = ( (pWndTreeGrid->GetStyle()&WS_VISIBLE) != 0 ) ? true : false;
    if( ! bGridIsVisible )
        continue;
    LONG nRowNo = pWndTreeGrid->ItemGetVisibleIndexOf( hTreeItem );
    if( nRowNo < 0 )
        continue;
    CRect rcCellExtra;
    if( ! pWndTreeGrid->GridCellRectsGet( 1, nRowNo, 0, 0, NULL, &rcCellExtra ) )
        continue;
    pWndTreeGrid->InvalidateRect( &rcCellExtra );
    pWndTreeGrid->UpdateWindow(); // optional (to see the changes immediately)
}

Malcolm D Jul 15, 2007 - 6:45 PM

An additional issue I find ( this might be a problem with the inplace control). When I call PropertyStoreSyncronizeAll the in place control disappears. This might be expected, but the problem is that I am calling PropertyStoreSyncronizeAll from the CExtPropertyValue::Apply which sometimes gets called too much. When I click on the place where a button will appear, the inplace control gets activeated and then deactived on a single click-. which then causes the apply function to be called. In Apply I then call PropertyStoreSyncronizeAll which then makes any button disappear. I don’t think I have any choice about whether or not to call PropertyStoreSyncronizeAll in apply, but the the Apply gets called to much.

If I don’t click on the cell area where the button will appear, but elsewhere in the cell then I get another problem. THe button will appear on the first click, but on the second click on the button, the implace control finishes editing then calls Apply where I call synchronise which then makes the button disappear, so I can’t click on the button.
I get this problem with any cell which makes a "button" appear which also allows editing of the text.


I’m not sure what the solution is.

Malcolm

Technical Support Jul 16, 2007 - 1:38 PM

Could you tell what is the reason for calling the CExtPropertyGridCtrl::PropertyStoreSynchronizeAll() method from an overridden Apply() method? The property grid control applies the edited result automatically and you don’t need to synchronize the entire tree grids manually.