Professional UI Solutions
Site Map   /  Register


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 » Removing the sorting buttons in a CExtPropertyGridCtrl Collapse All
Subject Author Date
Krustys Donuts Sep 8, 2008 - 7:25 PM

In one particular CExtPropertyGridCtrl I have, I don’t want to allow the user to sort it.  I want to display only the Categorized view.  I would like to either:

(A) Remove the categorized/sorting toolbar buttons entirely;

(B) Gray out the Alphabetical sort button (or both buttons); or

(C) Have the Alphabetical sort button do nothing.

I remember reading in another Support thread that the CExtPropertyGridCtrl by default creates two CExtPropertyGridWnd’s: One for Categorized, and one for Sorted.  Would the solution to my dilemma be having it create only the CExtPropertyGridWnd for the Categorized view, and not create the CExtPropertyGridWnd for the Sorted view at all?  If so, how do I accomplish this feat?

Technical Support Sep 9, 2008 - 12:05 PM

The CExtPropertyGridCtrl::OnPgcCreateGrids() virtual method is called for creating tree grid windows (CExtPropertyGridWnd</code-derived) inside a <code>CExtPropertyGridCtrl property grid control. By default this method creates two tree grid windows: CExtPropertyGridWndCategorized and CExtPropertyGridWndSorted. You should override this virtual method and its body should be similar to the original one but create only the CExtPropertyGridWndCategorized tree grid window. Appropriate commands in toolbar inside property grid control will be handled/updated automatically. But if you need only a categorized tree grid, then, we guess, you don’t need a toolbar at all.

The CExtPropertyGridCtrl::OnPgcCreateBars() virtual method is invoked to create all the other windows inside a property grid control. These windows are called bars because they are located outside the active/selected tree grid window and automatically docked to the borders of the property grid control. You can also override this virtual method, copy source code from original method and comment creation of bars which you don’t want to see inside your property grid control. Please note, the CExtPropertyGridCtrl property grid control requires only at least one tree grid window created inside it. All the other windows can be removed.