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 » CExtPropertyStore::Combine Collapse All
Subject Author Date
Suhai Gyorgy Dec 11, 2006 - 9:07 AM

Dear Support,

Is there an easy way to have Combine method generate the intersection of the given PropertyStores, not the union of them? Meaning, the resulting PropertyStore should contain only the categories and values that are present in all the given PropertyStores.

Thank you,
Chris.

Technical Support Dec 12, 2006 - 12:00 PM

We have just added a CExtPropertyItem::AdjustIntersection() method which implements this feature. Here is how it works. For example, you have n objects and some properties are present in all n objects and some other properties are not. If you select these objects and want to display the combined properties in the property grid, then the new method allows you to exclude the properties that are not common to all objects and display only the common properties, i.e. the properties common to all objects. So if you have n objects with k properties and only 1 property is common, only this one property will be displayed in the grid. Please note that AdjustIntersection() takes a parameter (nIntersectionItemCount) that in most cases should be set to the number of objects (combined property stores) and in this case the method will leave only the properties common to all objects (property stores). You can set some m less than <n in this parameter if you want to display properties that are common only to m objects but although it may be useful in some cases, it would implement the idea of non-strict intersection.

So it is really easy to use it. For example, you have three objects selected in the design area. First, create a combined property store which is merged from the three source property stores corresponding to the objects. Secondly, invoke pCombinedPropertyStore->AdjustIntersection( 3 ) for the combined property store to remove all the mixed property values which are absent in all the three source property stores.

We tested the method using a modified version of the Compound Properties sample which shows property stores of three ellipse objects named "Object 1", "Object 2" and "Object 3". The CCanvasObject::GetPropertyStore() method was modified to make the number of properties of "Object 1" less than in other two objects. If you run the sample and change the selection in the combo box, you will see the difference. The changes were made only to ..\Prof-UIS\Samples\CompoundProperties\MainDlg.cpp (download it) and you can easily find them by doing a search for INTERSECTION TEST. You can download the updated library code from our ftp site.