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 » Problem with PropertyStoreSynchronize Collapse All
Subject Author Date
a a Jan 18, 2006 - 2:22 AM

In order to make a dynamic property grid control, with categories and property values changing according to what the user sets in a CExtGridCellComboBox-derived,
I overrided the Apply method like in the example, modified the property grid, and called PropertyStoreSynchronize to refresh the control.


I tried 2 ways to do that: inserting/removing/modifying properties, and hiding/showing properties with CanBeInsertedIntoPropertyGrid.
Both seemed to work, except one thing: calling PropertyStoreSynchronize (inside the overrided Apply method) when nothing was modified results in an error.


As this error doesn’t let me see the call stack, nor debug step by step, I was unable to see what’s wrong.
Can you give me an explanation on why this happens? Or is this provoked by something else?


Also, I couldn’t resolve the conflict between DEBUG_NEW and CExtGridCell. In my case, I’m not deriving any CExtGridCell call,
I’m just trying to instanciate a CExtGridCellString, but when this line appears after the definition of DEBUG_NEW, I get the char[50] error on this line:


  CExtGridCellString &v = *new CExtGridCellString();


Is there something special to do to have this line work?

a a Jan 18, 2006 - 2:27 AM

Code excerpt:


void StyleTypeProperty::Apply(CExtGridCell *v)
{
  CExtPropertyValue::Apply(v);


  if (v == NULL)
    return;


  CExtGridCellString &text_value =
    *static_cast<CExtGridCellString *>(v);


  {
    CExtSafeString s;
    text_value.TextGet(s);
   
    // modify etc...
   
    _grid_control.PropertyStoreSynchronize();
  }
}


Anyway, I think it would be nice to set an assertion even if this code is wrong.

Technical Support Jan 18, 2006 - 10:59 AM

If you have a custom grid cell class in your project, then you need to put its DECLARE_DYNCREATE line of code before the declaration of the DEBUG_NEW in the .cpp file. Please take a look at the beginning of the MainDlg.cpp file in the CompoundProperties sample:

IMPLEMENT_SERIAL( CMyCompoundFontCell, CExtPropertyGridCellCompound, VERSIONABLE_SCHEMA|1 );
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
We have improved the property grid control after release 2.50 and fixed several important issues related to the property store synchronization when some value is being applied. Please let us know which version of Prof-UIS/Visual Studio you are using?

a a Jan 18, 2006 - 6:22 PM

excerpt of the code failing on compilation (with the DEBUG_NEW conflict):



OptionalPropertyTest::OptionalPropertyTest() : CExtPropertyValue("option")
{
  DescriptionSet("just a test");
  CExtGridCellString &v = *new CExtGridCellString(); // error here
  v.TextSet("test");


  ValueActiveSet(&v);
  ValueDefaultFromActive();
}


I’m not implementing any cell-derived class. Do I need to set macros for built-in cells too?
Is there somewhere we can find all the macros we need to know? I haven’t seen anything in the help file about this kind of ’requirement’.


And I’m using Visual Studio 2003, so 701, and (supposed to be using) ProfUIS v.2.51, though the dlls I built are ProfUIS250*...


Another thing.
As of now, I’m going to implement a cell type for RGBA colors. I wanted to ask you if there is already a cell type for that.
I tested CExtGridCellColor cells but they’re only for RGB right? Or is there a hidden option to add the Alpha component?
(Compound with CExtGridCellColor + integer wasn’t sufficient)


Thanks.


PS: this is the second time session times out while typing a message... Maybe you should increase the session delay.

Technical Support Jan 22, 2006 - 6:47 AM

The compilation of the new operator fails because CExtGridCell defines its own new and new operators with parameters. The CExtGridCell class is designed to be created on the internal heap of the data provider component of the grid window. This heap is a memory management component based on fast block allocations. You cannot use the standard new operator with CExtGridCell or any derived from it. The grid cells can exist as stack variables or as part of grid’s data provider only.

As for the RGBA cell, currently there is no such cell in Prof-UIS. But you can implement it yourself from scratch as a compound cell. Please take a look at the compound color cells in the CompoundProperties sample.

We increased the session time to one hour from 20 minutes.

a a Jan 22, 2006 - 6:15 PM

Thanks.


I didn’t really want to make a CExtPropertyValueCompound because I wanted to have the RGBA cells work on the property grid but also on the data grid.
But finally, I think I will give up. I’ll use CExtPropertyValueCompound for the property grid and use 2 cells for the data grid.


As for the problem with PropertyStoreSynchronize, I noticed it occured only for CExtGridCellComboBox-derived and when in-place editing is enabled.
When the user clicks on the combo box (in-place editing activates) and leaves (applies) without changing the value, I get the error.
The same thing occurs when the user clicks and uses the mouse wheel to change the value.
So I disabled the in-place editing.