# wxPropertyGridManager Class Reference
[wxPropertyGrid]

`#include <wx/propgrid/manager.h>`

Inheritance diagram for wxPropertyGridManager:
[legend]

## Detailed Description

wxPropertyGridManager is an efficient multi-page version of wxPropertyGrid, which can optionally have toolbar for mode and page selection, a help text box, and a header.

wxPropertyGridManager inherits from wxPropertyGridInterface, and as such it has most property manipulation functions. However, only some of them affect properties on all pages (eg. GetPropertyByName() and ExpandAll()), while some (eg. Append()) only apply to the currently selected page.

To operate explicitly on properties on specific page, use wxPropertyGridManager::GetPage() to obtain pointer to page's wxPropertyGridPage object.

Visual methods, such as SetCellBackgroundColour() are only available in wxPropertyGrid. Use wxPropertyGridManager::GetGrid() to obtain pointer to it.

Non-virtual iterators will not work in wxPropertyGridManager. Instead, you must acquire the internal grid (GetGrid()) or wxPropertyGridPage object (GetPage()).

wxPropertyGridManager constructor has exact same format as wxPropertyGrid constructor, and basicly accepts same extra window style flags (albeit also has some extra ones).

Here's some example code for creating and populating a wxPropertyGridManager:

            wxPropertyGridManager* pgMan = new wxPropertyGridManager(this, PGID,
                wxDefaultPosition, wxDefaultSize,
                // These and other similar styles are automatically
                // passed to the embedded wxPropertyGrid.
                wxPG_BOLD_MODIFIED|wxPG_SPLITTER_AUTO_CENTER|
                // Include toolbar.
                wxPG_TOOLBAR |
                // Include description box.
                wxPG_DESCRIPTION |
                // Include compactor.
                wxPG_COMPACTOR |
                // Plus defaults.
                wxPGMAN_DEFAULT_STYLE
               );

            wxPropertyGridPage* page;

            page = pgMan->AddPage("First Page");

            page->Append( new wxPropertyCategory("Category A1") );

            page->Append( new wxIntProperty("Number",wxPG_LABEL,1) );

            page->Append( new wxColourProperty("Colour",wxPG_LABEL,*wxWHITE) );

            page = pgMan->AddPage("Second Page");

            page->Append( "Text",wxPG_LABEL,"(no text)" );

            page->Append( new wxFontProperty("Font",wxPG_LABEL) );

            // Display a header above the grid
            pgMan->ShowHeader();

## Window Styles

See wxPropertyGrid Window Styles.

## Event Handling

See wxPropertyGrid Event Handling for more information.

##

Library: wxPropertyGrid

Category: wxPropertyGrid

## Public Member Functions
wxPropertyGridPage * | AddPage (const wxString &label=wxEmptyString, const wxBitmap &bmp=wxPG_NULL_BITMAP, wxPropertyGridPage *pageObj=NULL)
| Creates new property page.
virtual void | Clear ()
| Deletes all properties and all pages.
void | ClearPage (int page)
| Deletes all properties on given page.
bool | CommitChangesFromEditor (wxUint32 flags=0)
| Forces updating the value of property from the editor control.
bool | Create (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxPGMAN_DEFAULT_STYLE, const wxChar *name=wxPropertyGridManagerNameStr)
| Two step creation.
bool | EnableCategories (bool enable)
| Enables or disables (shows/hides) categories according to parameter enable.
bool | EnsureVisible (wxPGPropArg id)
| Selects page, scrolls and/or expands items to ensure that the given item is visible.
int | GetColumnCount (int page=-1) const
| Returns number of columns on given page.
int | GetDescBoxHeight () const
| Returns height of the description text box.
wxPropertyGrid * | GetGrid ()
| Returns pointer to the contained wxPropertyGrid.
virtual wxPGVIterator | GetVIterator (int flags) const
| Similar to GetIterator, but instead returns wxPGVIterator instance, which can be useful for forward-iterating through arbitrary property containers.
wxPropertyGridPage * | GetCurrentPage () const
| Returns currently selected page.
wxPropertyGridPage * | GetPage (unsigned int ind) const
| Returns page object for given page index.
wxPropertyGridPage * | GetPage (const wxString &name) const
| Returns page object for given page name.
int | GetPageByName (const wxString &name) const
| Returns index for a page name.
size_t | GetPageCount () const
| Returns number of managed pages.
const wxString & | GetPageName (int index) const
| Returns name of given page.
wxPGProperty * | GetPageRoot (int index) const
| Returns "root property" of the given page.
int | GetSelectedPage () const
| Returns index to currently selected page.
wxPGProperty * | GetSelectedProperty () const
| Shortcut for GetGrid()->GetSelection().
int | GetSelection () const
| Synonyme for GetSelectedPage.
wxToolBar * | GetToolBar () const
| Returns a pointer to the toolbar currently associated with the wxPropertyGridManager (if any).
virtual wxPropertyGridPage * | InsertPage (int index, const wxString &label, const wxBitmap &bmp=wxNullBitmap, wxPropertyGridPage *pageObj=NULL)
| Creates new property page.
bool | IsAnyModified () const
| Returns true if any property on any page has been modified by the user.
bool | IsFrozen () const
| Returns true if updating is frozen (ie.
bool | IsPageModified (size_t index) const
| Returns true if any property on given page has been modified by the user.
virtual bool | IsPropertySelected (wxPGPropArg id) const
| Returns true if property is selected.
virtual bool | RemovePage (int page)
| Removes a page.
void | SelectPage (int index)
| Select and displays a given page.
void | SelectPage (const wxString &label)
| Select and displays a given page (by label).
void | SelectPage (wxPropertyGridPage *page)
| Select and displays a given page.
bool | SelectProperty (wxPGPropArg id, bool focus=false)
| Select a property.
void | SetColumnCount (int colCount, int page=-1)
| Sets number of columns on given page (default is current page).
void | SetColumnTitle (int idx, const wxString &title)
| Sets a column title.
void | SetDescription (const wxString &label, const wxString &content)
| Sets label and text in description box.
void | SetDescBoxHeight (int ht, bool refresh=true)
| Sets y coordinate of the description box splitter.
void | SetSplitterLeft (bool subProps=false, bool allPages=true)
| Moves splitter as left as possible, while still allowing all labels to be shown in full.
void | SetPageSplitterPosition (int page, int pos, int column=0)
| Sets splitter position on individual page.
void | SetSplitterPosition (int pos, int column=0)
| Sets splitter position for all pages.
void | SetStringSelection (const wxChar *name)
| Synonyme for SelectPage(name).
void | ShowHeader (bool show=true)
| Show or hide the property grid header control.
## Protected Member Functions
virtual wxPropertyGrid * | CreatePropertyGrid () const
| Creates property grid for the manager.

List of all members.

## Member Function Documentation

wxPropertyGridPage* wxPropertyGridManager::AddPage | ( | const wxString & | label = `wxEmptyString`,
|  | const wxBitmap & | bmp = `wxPG_NULL_BITMAP`,
|  | wxPropertyGridPage * | pageObj = `NULL` |
| ) |  |  |

Creates new property page.

Note that the first page is not created automatically.

Parameters:

  | label | A label for the page. This may be shown as a toolbar tooltip etc.
  | bmp | Bitmap image for toolbar. If wxNullBitmap is used, then a built-in default image is used.
  | pageObj | wxPropertyGridPage instance. Manager will take ownership of this object. NULL indicates that a default page instance should be created.

Returns:
  Returns pointer to created property grid page.

Remarks:
  If toolbar is used, it is highly recommended that the pages are added when the toolbar is not turned off using window style flag switching. Otherwise toolbar buttons might not be added properly.

virtual void wxPropertyGridManager::Clear | ( |  | ) | `[virtual]`

Deletes all properties and all pages.

Implements wxPropertyGridInterface.

void wxPropertyGridManager::ClearPage | ( | int | page | ) |

Deletes all properties on given page.

bool wxPropertyGridManager::CommitChangesFromEditor | ( | wxUint32 | flags = `0` | ) |

Forces updating the value of property from the editor control.

Returns:
  Returns true if value was actually updated.

bool wxPropertyGridManager::Create | ( | wxWindow * | parent,
|  | wxWindowID | id = `wxID_ANY`,
|  | const wxPoint & | pos = `wxDefaultPosition`,
|  | const wxSize & | size = `wxDefaultSize`,
|  | long | style = `wxPGMAN_DEFAULT_STYLE`,
|  | const wxChar * | name = `wxPropertyGridManagerNameStr` |
| ) |  |  |

Two step creation.

Whenever the control is created without any parameters, use Create to actually create it. Don't access the control's public methods before this is called.

See also:
  wxPropertyGrid Window Styles

virtual wxPropertyGrid* wxPropertyGridManager::CreatePropertyGrid | ( |  | ) | const`[protected, virtual]`

Creates property grid for the manager.

Reimplement in derived class to use subclassed wxPropertyGrid. However, if you do this then you must also use the two-step construction (ie. default constructor and Create() instead of constructor with arguments) when creating the manager.

bool wxPropertyGridManager::EnableCategories | ( | bool | enable | ) |

Enables or disables (shows/hides) categories according to parameter enable.

Remarks:
  Calling his may not properly update toolbar buttons.

bool wxPropertyGridManager::EnsureVisible | ( | wxPGPropArg | id | ) |

Selects page, scrolls and/or expands items to ensure that the given item is visible.

Returns:
  Returns true if something was actually done.

int wxPropertyGridManager::GetColumnCount | ( | int | page = `-1` | ) | const

Returns number of columns on given page.

By the default, returns number of columns on current page.

wxPropertyGridPage* wxPropertyGridManager::GetCurrentPage | ( |  | ) | const

Returns currently selected page.

int wxPropertyGridManager::GetDescBoxHeight | ( |  | ) | const

Returns height of the description text box.

wxPropertyGrid* wxPropertyGridManager::GetGrid | ( |  | ) |

Returns pointer to the contained wxPropertyGrid.

This does not change after wxPropertyGridManager has been created, so you can safely obtain pointer once and use it for the entire lifetime of the manager instance.

wxPropertyGridPage* wxPropertyGridManager::GetPage | ( | const wxString & | name | ) | const

Returns page object for given page name.

wxPropertyGridPage* wxPropertyGridManager::GetPage | ( | unsigned int | ind | ) | const

Returns page object for given page index.

int wxPropertyGridManager::GetPageByName | ( | const wxString & | name | ) | const

Returns index for a page name.

If no match is found, wxNOT_FOUND is returned.

size_t wxPropertyGridManager::GetPageCount | ( |  | ) | const

Returns number of managed pages.

const wxString& wxPropertyGridManager::GetPageName | ( | int | index | ) | const

Returns name of given page.

wxPGProperty* wxPropertyGridManager::GetPageRoot | ( | int | index | ) | const

Returns "root property" of the given page.

It does not have name, etc. and it is not visible. It is only useful for accessing its children.

int wxPropertyGridManager::GetSelectedPage | ( |  | ) | const

Returns index to currently selected page.

wxPGProperty* wxPropertyGridManager::GetSelectedProperty | ( |  | ) | const

Shortcut for GetGrid()->GetSelection().

int wxPropertyGridManager::GetSelection | ( |  | ) | const

Synonyme for GetSelectedPage.

Reimplemented from wxPropertyGridInterface.

wxToolBar* wxPropertyGridManager::GetToolBar | ( |  | ) | const

Returns a pointer to the toolbar currently associated with the wxPropertyGridManager (if any).

virtual wxPGVIterator wxPropertyGridManager::GetVIterator | ( | int | flags | ) | const`[virtual]`

Similar to GetIterator, but instead returns wxPGVIterator instance, which can be useful for forward-iterating through arbitrary property containers.

Reimplemented from wxPropertyGridInterface.

virtual wxPropertyGridPage* wxPropertyGridManager::InsertPage | ( | int | index,
|  | const wxString & | label,
|  | const wxBitmap & | bmp = `wxNullBitmap`,
|  | wxPropertyGridPage * | pageObj = `NULL` |
| ) |  |  | `[virtual]`

Creates new property page.

Note that the first page is not created automatically.

Parameters:

  | index | Add to this position. -1 will add as the last item.
  | label | A label for the page. This may be shown as a toolbar tooltip etc.
  | bmp | Bitmap image for toolbar. If wxNullBitmap is used, then a built-in default image is used.
  | pageObj | wxPropertyGridPage instance. Manager will take ownership of this object. If NULL, default page object is constructed.

Returns:
  Returns pointer to created page.

bool wxPropertyGridManager::IsAnyModified | ( |  | ) | const

Returns true if any property on any page has been modified by the user.

bool wxPropertyGridManager::IsFrozen | ( |  | ) | const

Returns true if updating is frozen (ie.

Freeze() called but not yet Thaw() ).

Reimplemented from wxWindow.

bool wxPropertyGridManager::IsPageModified | ( | size_t | index | ) | const

Returns true if any property on given page has been modified by the user.

virtual bool wxPropertyGridManager::IsPropertySelected | ( | wxPGPropArg | id | ) | const`[virtual]`

Returns true if property is selected.

Since selection is page based, this function checks every page in the manager.

Reimplemented from wxPropertyGridInterface.

virtual bool wxPropertyGridManager::RemovePage | ( | int | page | ) | `[virtual]`

Removes a page.

Returns:
  Returns false if it was not possible to remove page in question.

void wxPropertyGridManager::SelectPage | ( | wxPropertyGridPage * | page | ) |

Select and displays a given page.

void wxPropertyGridManager::SelectPage | ( | const wxString & | label | ) |

Select and displays a given page (by label).

void wxPropertyGridManager::SelectPage | ( | int | index | ) |

Select and displays a given page.

Parameters:

  | index | Index of page being seleced. Can be -1 to select nothing.

bool wxPropertyGridManager::SelectProperty | ( | wxPGPropArg | id,
|  | bool | focus = `false` |
| ) |  |  |

Select a property.

See also:
  wxPropertyGrid::SelectProperty(), wxPropertyGridInterface::ClearSelection()

void wxPropertyGridManager::SetColumnCount | ( | int | colCount,
|  | int | page = `-1` |
| ) |  |  |

Sets number of columns on given page (default is current page).

Remarks:
  If you use header, then you should always use this member function to set the column count, instead of ones present in wxPropertyGrid or wxPropertyGridPage.

void wxPropertyGridManager::SetColumnTitle | ( | int | idx,
|  | const wxString & | title |
| ) |  |  |

Sets a column title.

Default title for column 0 is "Property", and "Value" for column 1.

Remarks:
  If header is not shown yet, then calling this member function will make it visible.

void wxPropertyGridManager::SetDescBoxHeight | ( | int | ht,
|  | bool | refresh = `true` |
| ) |  |  |

Sets y coordinate of the description box splitter.

void wxPropertyGridManager::SetDescription | ( | const wxString & | label,
|  | const wxString & | content |
| ) |  |  |

Sets label and text in description box.

void wxPropertyGridManager::SetPageSplitterPosition | ( | int | page,
|  | int | pos,
|  | int | column = `0` |
| ) |  |  |

Sets splitter position on individual page.

Remarks:
  If you use header, then you should always use this member function to set the splitter position, instead of ones present in wxPropertyGrid or wxPropertyGridPage.

void wxPropertyGridManager::SetSplitterLeft | ( | bool | subProps = `false`,
|  | bool | allPages = `true` |
| ) |  |  |

Moves splitter as left as possible, while still allowing all labels to be shown in full.

Parameters:

  | subProps | If false, will still allow sub-properties (ie. properties which parent is not root or category) to be cropped.
  | allPages | If true, takes labels on all pages into account.

void wxPropertyGridManager::SetSplitterPosition | ( | int | pos,
|  | int | column = `0` |
| ) |  |  |

Sets splitter position for all pages.

Remarks:
  Splitter position cannot exceed grid size, and therefore setting it during form creation may fail as initial grid size is often smaller than desired splitter position, especially when sizers are being used.

If you use header, then you should always use this member function to set the splitter position, instead of ones present in wxPropertyGrid or wxPropertyGridPage.

void wxPropertyGridManager::SetStringSelection | ( | const wxChar * | name | ) |

Synonyme for SelectPage(name).

void wxPropertyGridManager::ShowHeader | ( | bool | show = `true` | ) |

Show or hide the property grid header control.

It is hidden by the default.

Remarks:
  Grid may look better if you use wxPG_NO_INTERNAL_BORDER window style when showing a header.

|  | [ top ]