.\" This is a wxWidgets manpage page generated from the XML docs .TH wxGrid 3wx 2005-02-15 "wxWidgets" "wxWidgets class documentation" .SH NAME wxGrid \- A grid (table) window .SH DESCRIPTION wxGrid and its related classes are used for displaying and editing tabular data. They provide a rich set of features for display, editing, and interacting with a variety of data sources. For simple applications, and to help you get started, wxGrid is the only class you need to refer to directly. It will set up default instances of the other classes and manage them for you. For more complex applications you can derive your own classes for custom grid views, grid data tables, cell editors and renderers. The wxGrid classes overview has examples of simple and more complex applications, explains the relationship between the various grid classes and has a summary of the keyboard shortcuts and mouse functions provided by wxGrid. wxGrid has been greatly expanded and redesigned for wxWidgets 2.2 onwards. If you have been using the old wxGrid class you will probably want to have a look at the wxGrid classes overview to see how things have changed. The new grid classes are reasonably backward-compatible but there are some exceptions. There are also easier ways of doing many things compared to the previous implementation. .SH "PARENTS" wxScrolledWindow wxWindow wxEvtHandler wxObject .SH "INCLUDE FILES" wx/grid.h .SH MEMBERS .SS wxGrid () Default constructor .SS wxGrid (wxWindow* parentwxWindowID idconst wxPoint& pos = wxDefaultPositionconst wxSize& size = wxDefaultSizelong style = wxWANTS_CHARSconst wxString& name = wxPanelNameStr) Constructor to create a grid object. Call either wxGrid::CreateGrid or wxGrid::SetTable directly after this to initialize the grid before using it. .SS ~wxGrid () Destructor. This will also destroy the associated grid table unless you passed a table object to the grid and specified that the grid should not take ownership of the table (see wxGrid::SetTable ). .SS bool AppendCols (int numCols = 1bool updateLabels = true) Appends one or more new columns to the right of the grid and returns true if successful. The updateLabels argument is not used at present. If you are using a derived grid table class you will need to override wxGridTableBase::AppendCols . See wxGrid::InsertCols for further information. .SS bool AppendRows (int numRows = 1bool updateLabels = true) Appends one or more new rows to the bottom of the grid and returns true if successful. The updateLabels argument is not used at present. If you are using a derived grid table class you will need to override wxGridTableBase::AppendRows . See wxGrid::InsertRows for further information. .SS void AutoSize () Automatically sets the height and width of all rows and columns to fit their contents. .SS void AutoSizeColOrRow (int nbool setAsMinbool column) Common part of AutoSizeColumn/Row() or row? .SS void AutoSizeColumn (int colbool setAsMin = true) Automatically sizes the column to fit its contents. If setAsMin is true the calculated width will also be set as the minimal width for the column. .SS void AutoSizeColumns (bool setAsMin = true) Automatically sizes all columns to fit their contents. If setAsMin is true the calculated widths will also be set as the minimal widths for the columns. .SS void AutoSizeRow (int rowbool setAsMin = true) Automatically sizes the row to fit its contents. If setAsMin is true the calculated height will also be set as the minimal height for the row. .SS void AutoSizeRows (bool setAsMin = true) Automatically sizes all rows to fit their contents. If setAsMin is true the calculated heights will also be set as the minimal heights for the rows. .SS void BeginBatch () Increments the grid's batch count. When the count is greater than zero repainting of the grid is suppressed. Each call to BeginBatch must be matched by a later call to wxGrid::EndBatch . Code that does a lot of grid modification can be enclosed between BeginBatch and EndBatch calls to avoid screen flicker. The final EndBatch will cause the grid to be repainted. .SS wxRect BlockToDeviceRect (const wxGridCellCoords & topLeftconst wxGridCellCoords & bottomRight) This function returns the rectangle that encloses the block of cells limited by TopLeft and BottomRight cell in device coords and clipped to the client size of the grid window. .SS bool CanDragColSize () Returns true if columns can be resized by dragging with the mouse. Columns can be resized by dragging the edges of their labels. If grid line dragging is enabled they can also be resized by dragging the right edge of the column in the grid cell area (see wxGrid::EnableDragGridSize ). .SS bool CanDragRowSize () Returns true if rows can be resized by dragging with the mouse. Rows can be resized by dragging the edges of their labels. If grid line dragging is enabled they can also be resized by dragging the lower edge of the row in the grid cell area (see wxGrid::EnableDragGridSize ). .SS bool CanDragGridSize () Return true if the dragging of grid lines to resize rows and columns is enabled or false otherwise. .SS bool CanEnableCellControl () Returns true if the in-place edit control for the current grid cell can be used and false otherwise (e.g. if the current cell is read-only). .SS bool CanHaveAttributes () Do we have some place to store attributes in? .SS wxRect CellToRect (int rowint col) .SS wxRect CellToRect (const wxGridCellCoords& coords) Return the rectangle corresponding to the grid cell's size and position in logical coordinates. .SS void ClearGrid () Clears all data in the underlying grid table and repaints the grid. The table is not deleted by this function. If you are using a derived table class then you need to override wxGridTableBase::Clear for this function to have any effect. .SS void ClearSelection () Deselects all cells that are currently selected. .SS bool CreateGrid (int numRowsint numColswxGrid::wxGridSelectionModes selmode = wxGrid::wxGridSelectCells) Creates a grid with the specified initial number of rows and columns. Call this directly after the grid constructor. When you use this function wxGrid will create and manage a simple table of string values for you. All of the grid data will be stored in memory. For applications with more complex data types or relationships, or for dealing with very large datasets, you should derive your own grid table class and pass a table object to the grid with wxGrid::SetTable . .SS bool DeleteCols (int pos = 0int numCols = 1bool updateLabels = true) Deletes one or more columns from a grid starting at the specified position and returns true if successful. The updateLabels argument is not used at present. If you are using a derived grid table class you will need to override wxGridTableBase::DeleteCols . See wxGrid::InsertCols for further information. .SS bool DeleteRows (int pos = 0int numRows = 1bool updateLabels = true) Deletes one or more rows from a grid starting at the specified position and returns true if successful. The updateLabels argument is not used at present. If you are using a derived grid table class you will need to override wxGridTableBase::DeleteRows . See wxGrid::InsertRows for further information. .SS void DisableCellEditControl () Disables in-place editing of grid cells. Equivalent to calling EnableCellEditControl(false). .SS void DisableDragColSize () Disables column sizing by dragging with the mouse. Equivalent to passing false to wxGrid::EnableDragColSize . .SS void DisableDragGridSize () Disable mouse dragging of grid lines to resize rows and columns. Equivalent to passing false to wxGrid::EnableDragGridSize .SS void DisableDragRowSize () Disables row sizing by dragging with the mouse. Equivalent to passing false to wxGrid::EnableDragRowSize . .SS void EnableCellEditControl (bool enable = true) Enables or disables in-place editing of grid cell data. The grid will issue either a wxEVT_GRID_EDITOR_SHOWN or wxEVT_GRID_EDITOR_HIDDEN event. .SS void EnableDragColSize (bool enable = true) Enables or disables column sizing by dragging with the mouse. .SS void EnableDragGridSize (bool enable = true) Enables or disables row and column resizing by dragging gridlines with the mouse. .SS void EnableDragRowSize (bool enable = true) Enables or disables row sizing by dragging with the mouse. .SS void EnableEditing (bool edit) If the edit argument is false this function sets the whole grid as read-only. If the argument is true the grid is set to the default state where cells may be editable. In the default state you can set single grid cells and whole rows and columns to be editable or read-only via wxGridCellAttribute::SetReadOnly . For single cells you can also use the shortcut function wxGrid::SetReadOnly . For more information about controlling grid cell attributes see the wxGridCellAttr cell attribute class and the wxGrid classes overview . .SS void EnableGridLines (bool enable = true) Turns the drawing of grid lines on or off. .SS void EndBatch () Decrements the grid's batch count. When the count is greater than zero repainting of the grid is suppressed. Each previous call to wxGrid::BeginBatch must be matched by a later call to EndBatch. Code that does a lot of grid modification can be enclosed between BeginBatch and EndBatch calls to avoid screen flicker. The final EndBatch will cause the grid to be repainted. .SS void Fit () Overridden wxWindow method. .SS void ForceRefresh () Causes immediate repainting of the grid. Use this instead of the usual wxWindow::Refresh. .SS int GetBatchCount () Returns the number of times that wxGrid::BeginBatch has been called without (yet) matching calls to wxGrid::EndBatch . While the grid's batch count is greater than zero the display will not be updated. .SS void GetCellAlignment (int rowint colint* horizint* vert) Sets the arguments to the horizontal and vertical text alignment values for the grid cell at the specified location. Horizontal alignment will be one of wxALIGN_LEFT, wxALIGN_CENTRE or wxALIGN_RIGHT. Vertical alignment will be one of wxALIGN_TOP, wxALIGN_CENTRE or wxALIGN_BOTTOM. .SS wxColour GetCellBackgroundColour (int rowint col) Returns the background colour of the cell at the specified location. .SS wxGridCellEditor* GetCellEditor (int rowint col) Returns a pointer to the editor for the cell at the specified location. See wxGridCellEditor and the wxGrid overview for more information about cell editors and renderers. .SS wxFont GetCellFont (int rowint col) Returns the font for text in the grid cell at the specified location. .SS wxGridCellRenderer* GetCellRenderer (int rowint col) Returns a pointer to the renderer for the grid cell at the specified location. See wxGridCellRenderer and the wxGrid overview for more information about cell editors and renderers. .SS wxColour GetCellTextColour (int rowint col) Returns the text colour for the grid cell at the specified location. .SS wxString GetCellValue (int rowint col) .SS wxString GetCellValue (const wxGridCellCoords&coords) Returns the string contained in the cell at the specified location. For simple applications where a grid object automatically uses a default grid table of string values you use this function together with wxGrid::SetCellValue to access cell values. For more complex applications where you have derived your own grid table class that contains various data types (e.g. numeric, boolean or user-defined custom types) then you only use this function for those cells that contain string values. See wxGridTableBase::CanGetValueAs and the wxGrid overview for more information. .SS int GetColLeft (int col) .SS void GetColLabelAlignment (int* horizint* vert) Sets the arguments to the current column label alignment values. Horizontal alignment will be one of wxALIGN_LEFT, wxALIGN_CENTRE or wxALIGN_RIGHT. Vertical alignment will be one of wxALIGN_TOP, wxALIGN_CENTRE or wxALIGN_BOTTOM. .SS int GetColLabelSize () Returns the current height of the column labels. .SS wxString GetColLabelValue (int col) Returns the specified column label. The default grid table class provides column labels of the form A,B...Z,AA,AB...ZZ,AAA... If you are using a custom grid table you can override wxGridTableBase::GetColLabelValue to provide your own labels. .SS int GetColMinimalAcceptableWidth () This returns the value of the lowest column width that can be handled correctly. See member SetColMinimalAcceptableWidth for details. .SS int GetColMinimalWidth (int col) Get the minimal width of the given column/row. .SS int GetColRight (int col) .SS int GetColSize (int col) Returns the width of the specified column. .SS void GetDefaultCellAlignment (int* horizint* vert) Sets the arguments to the current default horizontal and vertical text alignment values. Horizontal alignment will be one of wxALIGN_LEFT, wxALIGN_CENTRE or wxALIGN_RIGHT. Vertical alignment will be one of wxALIGN_TOP, wxALIGN_CENTRE or wxALIGN_BOTTOM. .SS wxColour GetDefaultCellBackgroundColour () Returns the current default background colour for grid cells. .SS wxFont GetDefaultCellFont () Returns the current default font for grid cell text. .SS wxColour GetDefaultCellTextColour () Returns the current default colour for grid cell text. .SS int GetDefaultColLabelSize () Returns the default height for column labels. .SS int GetDefaultColSize () Returns the current default width for grid columns. .SS wxGridCellEditor* GetDefaultEditor () Returns a pointer to the current default grid cell editor. See wxGridCellEditor and the wxGrid overview for more information about cell editors and renderers. .SS wxGridCellEditor* GetDefaultEditorForCell (int rowint col) .SS wxGridCellEditor* GetDefaultEditorForCell (const wxGridCellCoords& c) .SS wxGridCellEditor* GetDefaultEditorForType (const wxString& typeName) .SS wxGridCellRenderer* GetDefaultRenderer () Returns a pointer to the current default grid cell renderer. See wxGridCellRenderer and the wxGrid overview for more information about cell editors and renderers. .SS wxGridCellRenderer* GetDefaultRendererForCell (int rowint col) .SS wxGridCellRenderer* GetDefaultRendererForType (const wxString& typeName) .SS int GetDefaultRowLabelSize () Returns the default width for the row labels. .SS int GetDefaultRowSize () Returns the current default height for grid rows. .SS int GetGridCursorCol () Returns the current grid cell column position. .SS int GetGridCursorRow () Returns the current grid cell row position. .SS wxColour GetGridLineColour () Returns the colour used for grid lines. .SS bool GridLinesEnabled () Returns true if drawing of grid lines is turned on, false otherwise. .SS wxColour GetLabelBackgroundColour () Returns the colour used for the background of row and column labels. .SS wxFont GetLabelFont () Returns the font used for row and column labels. .SS wxColour GetLabelTextColour () Returns the colour used for row and column label text. .SS int GetNumberCols () Returns the total number of grid columns (actually the number of columns in the underlying grid table). .SS int GetNumberRows () Returns the total number of grid rows (actually the number of rows in the underlying grid table). .SS wxGridCellAttr* GetOrCreateCellAttr (int rowint col) .SS int GetRowMinimalAcceptableHeight () This returns the value of the lowest row width that can be handled correctly. See member SetRowMinimalAcceptableHeight for details. .SS int GetRowMinimalHeight (int col) .SS void GetRowLabelAlignment (int* horizint* vert) Sets the arguments to the current row label alignment values. Horizontal alignment will be one of wxLEFT, wxCENTRE or wxRIGHT. Vertical alignment will be one of wxTOP, wxCENTRE or wxBOTTOM. .SS int GetRowLabelSize () Returns the current width of the row labels. .SS wxString GetRowLabelValue (int row) Returns the specified row label. The default grid table class provides numeric row labels. If you are using a custom grid table you can override wxGridTableBase::GetRowLabelValue to provide your own labels. .SS int GetRowSize (int row) Returns the height of the specified row. .SS int GetScrollLinesX () Returns the number of pixels per horizontal scroll increment. The default is 15. .SS int GetScrollLinesY () Returns the number of pixels per vertical scroll increment. The default is 15. .SS wxGrid::wxGridSelectionModes GetSelectionMode () Returns the current selection mode, see wxGrid::SetSelectionMode . .SS wxGridCellCoordsArray GetSelectedCells () Returns an array of singly selected cells. .SS wxArrayInt GetSelectedCols () Returns an array of selected cols. .SS wxArrayInt GetSelectedRows () Returns an array of selected rows. .SS wxColour GetSelectionBackground () Access or update the selection fore/back colours .SS wxGridCellCoordsArray GetSelectionBlockTopLeft () Returns an array of the top left corners of blocks of selected cells, see wxGrid::GetSelectionBlockBottomRight . .SS wxGridCellCoordsArray GetSelectionBlockBottomRight () Returns an array of the bottom right corners of blocks of selected cells, see wxGrid::GetSelectionBlockTopLeft . .SS wxColour GetSelectionForeground () .SS wxGridTableBase * GetTable () Returns a base pointer to the current table object. .SS int GetViewWidth () Returned number of whole cols visible. .SS void HideCellEditControl () Hides the in-place cell edit control. .SS void InitColWidths () Init the m_colWidths/Rights arrays .SS void InitRowHeights () NB: never access m_row/col arrays directly because they are created on demand, always use accessor functions instead! Init the m_rowHeights/Bottoms arrays with default values. .SS bool InsertCols (int pos = 0int numCols = 1bool updateLabels = true) Inserts one or more new columns into a grid with the first new column at the specified position and returns true if successful. The updateLabels argument is not used at present. The sequence of actions begins with the grid object requesting the underlying grid table to insert new columns. If this is successful the table notifies the grid and the grid updates the display. For a default grid (one where you have called wxGrid::CreateGrid ) this process is automatic. If you are using a custom grid table (specified with wxGrid::SetTable ) then you must override wxGridTableBase::InsertCols in your derived table class. .SS bool InsertRows (int pos = 0int numRows = 1bool updateLabels = true) Inserts one or more new rows into a grid with the first new row at the specified position and returns true if successful. The updateLabels argument is not used at present. The sequence of actions begins with the grid object requesting the underlying grid table to insert new rows. If this is successful the table notifies the grid and the grid updates the display. For a default grid (one where you have called wxGrid::CreateGrid ) this process is automatic. If you are using a custom grid table (specified with wxGrid::SetTable ) then you must override wxGridTableBase::InsertRows in your derived table class. .SS bool IsCellEditControlEnabled () Returns true if the in-place edit control is currently enabled. .SS bool IsCurrentCellReadOnly () Returns true if the current cell has been set to read-only (see wxGrid::SetReadOnly ). .SS bool IsEditable () Returns false if the whole grid has been set as read-only or true otherwise. See wxGrid::EnableEditing for more information about controlling the editing status of grid cells. .SS bool IsInSelection (int rowint col) .SS bool IsInSelection (const wxGridCellCoords& coords) Is this cell currently selected. .SS bool IsReadOnly (int rowint col) Returns true if the cell at the specified location can't be edited. See also wxGrid::IsReadOnly . .SS bool IsSelection () Returns true if there are currently rows, columns or blocks of cells selected. .SS bool IsVisible (int rowint colbool wholeCellVisible = true) .SS bool IsVisible (const wxGridCellCoords& coordsbool wholeCellVisible = true) Returns true if a cell is either wholly visible (the default) or at least partially visible in the grid window. .SS void MakeCellVisible (int rowint col) .SS void MakeCellVisible (const wxGridCellCoords& coords) Brings the specified cell into the visible grid cell area with minimal scrolling. Does nothing if the cell is already visible. .SS bool MoveCursorDown (bool expandSelection) Moves the grid cursor down by one row. If a block of cells was previously selected it will expand if the argument is true or be cleared if the argument is false. \wxheading{Keyboard} This function is called for Down cursor key presses or Shift+Down to expand a selection. .SS bool MoveCursorLeft (bool expandSelection) Moves the grid cursor left by one column. If a block of cells was previously selected it will expand if the argument is true or be cleared if the argument is false. \wxheading{Keyboard} This function is called for Left cursor key presses or Shift+Left to expand a selection. .SS bool MoveCursorRight (bool expandSelection) Moves the grid cursor right by one column. If a block of cells was previously selected it will expand if the argument is true or be cleared if the argument is false. \wxheading{Keyboard} This function is called for Right cursor key presses or Shift+Right to expand a selection. .SS bool MoveCursorUp (bool expandSelection) Moves the grid cursor up by one row. If a block of cells was previously selected it will expand if the argument is true or be cleared if the argument is false. \wxheading{Keyboard} This function is called for Up cursor key presses or Shift+Up to expand a selection. .SS bool MoveCursorDownBlock (bool expandSelection) Moves the grid cursor down in the current column such that it skips to the beginning or end of a block of non-empty cells. If a block of cells was previously selected it will expand if the argument is true or be cleared if the argument is false. \wxheading{Keyboard} This function is called for the Ctrl+Down key combination. Shift+Ctrl+Down expands a selection. .SS bool MoveCursorLeftBlock (bool expandSelection) Moves the grid cursor left in the current row such that it skips to the beginning or end of a block of non-empty cells. If a block of cells was previously selected it will expand if the argument is true or be cleared if the argument is false. \wxheading{Keyboard} This function is called for the Ctrl+Left key combination. Shift+Ctrl+left expands a selection. .SS bool MoveCursorRightBlock (bool expandSelection) Moves the grid cursor right in the current row such that it skips to the beginning or end of a block of non-empty cells. If a block of cells was previously selected it will expand if the argument is true or be cleared if the argument is false. \wxheading{Keyboard} This function is called for the Ctrl+Right key combination. Shift+Ctrl+Right expands a selection. .SS bool MoveCursorUpBlock (bool expandSelection) Moves the grid cursor up in the current column such that it skips to the beginning or end of a block of non-empty cells. If a block of cells was previously selected it will expand if the argument is true or be cleared if the argument is false. \wxheading{Keyboard} This function is called for the Ctrl+Up key combination. Shift+Ctrl+Up expands a selection. .SS bool MovePageDown () Moves the grid cursor down by some number of rows so that the previous bottom visible row becomes the top visible row. \wxheading{Keyboard} This function is called for PgDn keypresses. .SS bool MovePageUp () Moves the grid cursor up by some number of rows so that the previous top visible row becomes the bottom visible row. \wxheading{Keyboard} This function is called for PgUp keypresses. .SS void RegisterDataType (const wxString& typeNamewxGridCellRenderer* rendererwxGridCellEditor* editor) Methods for a registry for mapping data types to Renderers/Editors .SS void SaveEditControlValue () Sets the value of the current grid cell to the current in-place edit control value. This is called automatically when the grid cursor moves from the current cell to a new cell. It is also a good idea to call this function when closing a grid since any edits to the final cell location will not be saved otherwise. .SS void SelectAll () Selects all cells in the grid. .SS void SelectBlock (int topRowint leftColint bottomRowint rightColbool addToSelected = false) .SS void SelectBlock (const wxGridCellCoords& topLeftconst wxGridCellCoords& bottomRightbool addToSelected = false) Selects a rectangular block of cells. If addToSelected is false then any existing selection will be deselected; if true the column will be added to the existing selection. .SS void SelectCol (int colbool addToSelected = false) Selects the specified column. If addToSelected is false then any existing selection will be deselected; if true the column will be added to the existing selection. .SS wxRect SelectionToDeviceRect () This function returns the rectangle that encloses the selected cells in device coords and clipped to the client size of the grid window. .SS void SelectRow (int rowbool addToSelected = false) Selects the specified row. If addToSelected is false then any existing selection will be deselected; if true the row will be added to the existing selection. .SS void SetCellAlignment (int rowint colint horizint vert) .SS void SetCellAlignment (int alignint rowint col) Sets the horizontal and vertical alignment for grid cell text at the specified location. Horizontal alignment should be one of wxALIGN_LEFT, wxALIGN_CENTRE or wxALIGN_RIGHT. Vertical alignment should be one of wxALIGN_TOP, wxALIGN_CENTRE or wxALIGN_BOTTOM. .SS void SetCellBackgroundColour (int rowint colconst wxColour& colour) .SS void SetCellEditor (int rowint colwxGridCellEditor* editor) Sets the editor for the grid cell at the specified location. The grid will take ownership of the pointer. See wxGridCellEditor and the wxGrid overview for more information about cell editors and renderers. .SS void SetCellFont (int rowint colconst wxFont& font) Sets the font for text in the grid cell at the specified location. .SS void SetCellRenderer (int rowint colwxGridCellRenderer* renderer) Sets the renderer for the grid cell at the specified location. The grid will take ownership of the pointer. See wxGridCellRenderer and the wxGrid overview for more information about cell editors and renderers. .SS void SetCellTextColour (int rowint colconst wxColour& colour) .SS void SetCellTextColour (const wxColour& valint rowint col) .SS void SetCellTextColour (const wxColour& colour) Sets the text colour for the grid cell at the specified location. .SS void SetCellValue (int rowint colconst wxString& s) .SS void SetCellValue (const wxGridCellCoords& coordsconst wxString& s) .SS void SetCellValue (const wxString& valint rowint col) Sets the string value for the cell at the specified location. For simple applications where a grid object automatically uses a default grid table of string values you use this function together with wxGrid::GetCellValue to access cell values. For more complex applications where you have derived your own grid table class that contains various data types (e.g. numeric, boolean or user-defined custom types) then you only use this function for those cells that contain string values. The last form is for backward compatibility only. See wxGridTableBase::CanSetValueAs and the wxGrid overview for more information. .SS void SetColAttr (int colwxGridCellAttr* attr) Sets the cell attributes for all cells in the specified column. For more information about controlling grid cell attributes see the wxGridCellAttr cell attribute class and the wxGrid classes overview . .SS void SetColFormatBool (int col) Sets the specified column to display boolean values. wxGrid displays boolean values with a checkbox. .SS void SetColFormatNumber (int col) Sets the specified column to display integer values. .SS void SetColFormatFloat (int colint width = -1int precision = -1) Sets the specified column to display floating point values with the given width and precision. .SS void SetColFormatCustom (int colconst wxString& typeName) Sets the specified column to display data in a custom format. See the wxGrid overview for more information on working with custom data types. .SS void SetColLabelAlignment (int horizint vert) Sets the horizontal and vertical alignment of column label text. Horizontal alignment should be one of wxALIGN_LEFT, wxALIGN_CENTRE or wxALIGN_RIGHT. Vertical alignment should be one of wxALIGN_TOP, wxALIGN_CENTRE or wxALIGN_BOTTOM. .SS void SetColLabelSize (int height) Sets the height of the column labels. .SS void SetColLabelValue (int colconst wxString& value) Set the value for the given column label. If you are using a derived grid table you must override wxGridTableBase::SetColLabelValue for this to have any effect. .SS void SetColMinimalWidth (int colint width) Sets the minimal width for the specified column. This should normally be called when creating the grid because it will not resize a column that is already narrower than the minimal width. The width argument must be higher than the minimimal acceptable column width, see wxGrid::GetColMinimalAcceptableWidth . .SS void SetColMinimalAcceptableWidth (int width) This modifies the minimum column width that can be handled correctly. Specifying a low value here allows smaller grid cells to be dealt with correctly. Specifying a value here which is much smaller than the actual minimum size will incur a performance penalty in the functions which perform grid cell index lookup on the basis of screen coordinates. This should normally be called when creating the grid because it will not resize existing columns with sizes smaller than the value specified here. .SS void SetColSize (int colint width) Sets the width of the specified column. This function does not refresh the grid. If you are calling it outside of a BeginBatch / EndBatch block you can use wxGrid::ForceRefresh to see the changes. Automatically sizes the column to fit its contents. If setAsMin is true the calculated width will also be set as the minimal width for the column. .SS void SetDefaultCellAlignment (int horizint vert) Sets the default horizontal and vertical alignment for grid cell text. Horizontal alignment should be one of wxALIGN_LEFT, wxALIGN_CENTRE or wxALIGN_RIGHT. Vertical alignment should be one of wxALIGN_TOP, wxALIGN_CENTRE or wxALIGN_BOTTOM. .SS void SetDefaultCellBackgroundColour (const wxColour& colour) Sets the default background colour for grid cells. .SS void SetDefaultCellFont (const wxFont& font) Sets the default font to be used for grid cell text. .SS void SetDefaultCellTextColour (const wxColour& colour) Sets the current default colour for grid cell text. .SS void SetDefaultEditor (wxGridCellEditor* editor) Sets the default editor for grid cells. The grid will take ownership of the pointer. See wxGridCellEditor and the wxGrid overview for more information about cell editors and renderers. .SS void SetDefaultRenderer (wxGridCellRenderer* renderer) Sets the default renderer for grid cells. The grid will take ownership of the pointer. See wxGridCellRenderer and the wxGrid overview for more information about cell editors and renderers. .SS void SetDefaultColSize (int widthbool resizeExistingCols = false) Sets the default width for columns in the grid. This will only affect columns subsequently added to the grid unless resizeExistingCols is true. .SS void SetDefaultRowSize (int heightbool resizeExistingRows = false) Sets the default height for rows in the grid. This will only affect rows subsequently added to the grid unless resizeExistingRows is true. .SS void SetGridCursor (int rowint col) Set the grid cursor to the specified cell. This function calls wxGrid::MakeCellVisible . .SS void SetGridLineColour (const wxColour&colour) Sets the colour used to draw grid lines. .SS void SetLabelBackgroundColour (const wxColour& colour) Sets the background colour for row and column labels. .SS void SetLabelFont (const wxFont& font) Sets the font for row and column labels. .SS void SetLabelTextColour (const wxColour& colour) Sets the colour for row and column label text. .SS void SetMargins (int extraWidthint extraHeight) A grid may occupy more space than needed for its rows/columns. This function allows to set how big this extra space is .SS int SetOrCalcColumnSizes (bool calcOnlybool setAsMin = true) Common part of AutoSizeColumn/Row() and GetBestSize() .SS int SetOrCalcRowSizes (bool calcOnlybool setAsMin = true) .SS void SetReadOnly (int rowint colbool isReadOnly = true) Makes the cell at the specified location read-only or editable. See also wxGrid::IsReadOnly . .SS void SetRowAttr (int rowwxGridCellAttr* attr) Sets the cell attributes for all cells in the specified row. See the wxGridCellAttr class for more information about controlling cell attributes. .SS void SetRowLabelAlignment (int horizint vert) Sets the horizontal and vertical alignment of row label text. Horizontal alignment should be one of wxALIGN_LEFT, wxALIGN_CENTRE or wxALIGN_RIGHT. Vertical alignment should be one of wxALIGN_TOP, wxALIGN_CENTRE or wxALIGN_BOTTOM. .SS void SetRowLabelSize (int width) Sets the width of the row labels. .SS void SetRowLabelValue (int rowconst wxString& value) Set the value for the given row label. If you are using a derived grid table you must override wxGridTableBase::SetRowLabelValue for this to have any effect. .SS void SetRowMinimalHeight (int rowint height) Sets the minimal height for the specified row. This should normally be called when creating the grid because it will not resize a row that is already shorter than the minimal height. The height argument must be higher than the minimimal acceptable row height, see wxGrid::GetRowMinimalAcceptableHeight . .SS void SetRowMinimalAcceptableHeight (int height) This modifies the minimum row width that can be handled correctly. Specifying a low value here allows smaller grid cells to be dealt with correctly. Specifying a value here which is much smaller than the actual minimum size will incur a performance penalty in the functions which perform grid cell index lookup on the basis of screen coordinates. This should normally be called when creating the grid because it will not resize existing rows with sizes smaller than the value specified here. .SS void SetRowSize (int rowint height) Sets the height of the specified row. This function does not refresh the grid. If you are calling it outside of a BeginBatch / EndBatch block you can use wxGrid::ForceRefresh to see the changes. Automatically sizes the column to fit its contents. If setAsMin is true the calculated width will also be set as the minimal width for the column. .SS void SetScrollLinesX (int x) Sets the number of pixels per horizontal scroll increment. The default is 15. Sometimes wxGrid has trouble setting the scrollbars correctly due to rounding errors: setting this to 1 can help. .SS void SetScrollLinesY (int y) Sets the number of pixels per vertical scroll increment. The default is 15. Sometimes wxGrid has trouble setting the scrollbars correctly due to rounding errors: setting this to 1 can help. .SS void SetSelectionBackground (const wxColour& c) .SS void SetSelectionForeground (const wxColour& c) .SS void SetSelectionMode (wxGrid::wxGridSelectionModes selmode) Set the selection behaviour of the grid. .SS bool SetTable (wxGridTableBase* tablebool takeOwnership = falsewxGrid::wxGridSelectionModes selmode = wxGrid::wxGridSelectCells) Passes a pointer to a custom grid table to be used by the grid. This should be called after the grid constructor and before using the grid object. If takeOwnership is set to true then the table will be deleted by the wxGrid destructor. Use this function instead of wxGrid::CreateGrid when your application involves complex or non-string data or data sets that are too large to fit wholly in memory. .SS void ShowCellEditControl () Displays the in-place cell edit control for the current cell. .SS int XToCol (int x) Returns the grid column that corresponds to the logical x coordinate. Returns wxNOT_FOUND if there is no column at the x position. .SS int XToEdgeOfCol (int x) Returns the column whose right hand edge is close to the given logical x position. If no column edge is near to this position wxNOT_FOUND is returned. .SS int YToEdgeOfRow (int y) Returns the row whose bottom edge is close to the given logical y position. If no row edge is near to this position wxNOT_FOUND is returned. .SS int YToRow (int y) Returns the grid row that corresponds to the logical y coordinate. Returns wxNOT_FOUND if there is no row at the y position. .SH "WINDOW STYLES" .SH EVENTS .SS EVT_GRID_COL_SIZE(func) The user resized a column by dragging it. Processes a wxEVT_GRID_COL_SIZE. .SS EVT_GRID_ROW_SIZE(func) The user resized a row by dragging it. Processes a wxEVT_GRID_ROW_SIZE. .SS EVT_GRID_CMD_COL_SIZE(func) The user resized a column by dragging it; variant taking a window identifier. Processes a wxEVT_GRID_COL_SIZE. .SS EVT_GRID_CMD_ROW_SIZE(func) The user resized a row by dragging it; variant taking a window identifier. Processes a wxEVT_GRID_ROW_SIZE. .SS EVT_GRID_RANGE_SELECT(func) The user selected a group of contiguous cells. Processes a wxEVT_GRID_RANGE_SELECT. .SS EVT_GRID_CMD_RANGE_SELECT(id, func) The user selected a group of contiguous cells; variant taking a window identifier. Processes a wxEVT_GRID_RANGE_SELECT. .SS EVT_GRID_EDITOR_CREATED(func) The editor for a cell was created. Processes a wxEVT_GRID_EDITOR_CREATED. .SS EVT_GRID_CMD_EDITOR_CREATED(id, func) The editor for a cell was created; variant taking a window identifier. Processes a wxEVT_GRID_EDITOR_CREATED. .SH "SEE ALSO" wxScrolledWindow wxWindow wxEvtHandler wxObject wxGrid overview .SH "AUTHORS" Documentation content by Julian Smart, Robert Roebling, Vadim Zeitlin, Robin Dunn, et al Conversion to manpage format by Arnout Engelen (http://bzzt.net), bugreports welcome.