customized gridtable Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
FrankRuppel
Earned a small fee
Earned a small fee
Posts: 11
Joined: Mon Feb 12, 2007 9:10 pm

customized gridtable

Post by FrankRuppel » Fri Feb 16, 2007 7:30 pm

Hello,

maybe you can help me.

i use wxGrid to create a table in my frame:

i got a table which is like:

A B C D ...
1
2
3
.
.

but i want to to have the names (A,B,C,D,.. in the rows and other things (Name, ID, ... in the columns):

Name ID Value
A
B
C
D
.
.

how can i get this? i know that i can manipulate the labels with SetRowLabelValue and SetColLabelValue but i think this dont work here, because i want the rows automatically named.

manianis
Experienced Solver
Experienced Solver
Posts: 72
Joined: Mon Jan 15, 2007 11:00 am

Post by manianis » Fri Feb 16, 2007 9:07 pm

try deriving from wxGridTableBase

Code: Select all

class MyCustomGrid : public wxGridTableBase
{
public:
   MyCustomGrid();
   ~MyCustomGrid();

   wxString GetColLabelValue(int col);
   wxString GetRowLabelValue(int row);
  
   ...
protected:
   wxArrayString m_colNames;
};

...

wxString MyCustomGrid::GetColLabelValue(int col)
{
  return m_colNames[col];
}

wxString MyCustomGrid::GetRowLabelValue(int row)
{
  return wxString::Format("%d", row + 1);
}

Post Reply