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 » Hide a n item in property grid? Collapse All
Subject Author Date
Takis Takoglou Apr 3, 2009 - 5:56 AM

Good day,


I would like to know if it is possible to hide/unhide an item within a property grid.


I know i could remove the item and store its parent/location and then recreate it when desired but isn’t optimal.


Thanx in advance,


Stakon.


 


 

Takis Takoglou Apr 8, 2009 - 7:38 AM

Good Day


I have done as you said but probably I am doing something wrong.


In a CExtPropertyValue derived class which creates a combo-box in the constructor, i have added th following line in the declaration (.h file):



virtual bool CanBeInsertedIntoPropertyGrid();


and then i define it as (in the .cpp file)


bool Color::CanBeInsertedIntoPropertyGrid()

{

bool a = CExtPropertyItem::CanBeInsertedIntoPropertyGrid();   //even without this line it doesn’t seem to work

return false ;

}


i call this function in the apply of that value, but nothing happens?


CanBeInsertedIntoPropertyGrid ();  // I call it here

CMainFrame *mainfrm = (CMainFrame *)AfxGetMainWnd();

mainfrm->m_wndInBarDlg.GridControl.PropertyStoreSynchronize ()  // I synchronize the propgrid



What am i doing wrong?


 


Thanx in advance


Stakon.

Technical Support Apr 8, 2009 - 1:23 PM

Here is the correct method signature:

virtual bool CanBeInsertedIntoPropertyGrid() const;
You forgot the const modifier.

Technical Support Apr 3, 2009 - 11:01 AM

You should use your CExtPropertyValue-derived class (and/or CExtPropertyCategory-derived) which implements the CExtPropertyItem::CanBeInsertedIntoPropertyGrid() virtual method. Your method should simply return a false flag if the property item should be hidden in the property grid control. You should invoke the CExtPropertyGridCtrl::PropertyStoreSynchronize() method if you want the property grid control to reload the property store tree after changing particular property items.