Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » Some petitions for GridCtrl
Some petitions for GridCtrl [message #27167] |
Tue, 29 June 2010 11:11 |
|
koldo
Messages: 3394 Registered: August 2008
|
Senior Veteran |
|
|
Hello Uno
I have some petitions to be implemented in GridCtrl.
If they are already implemented please tell me how to do it:
1. A kind of FindColumn function
Giving a column name, it returns its column index.
It could be like this:
int GridCtrl_FindColumn(GridCtrl &grid, String &colName) {
for (int i = 0; i < grid.GetColumnCount(); ++i) {
if (grid.GetColumnName(i) == colName)
return i;
}
return -1;
}
2. Copy to Clipboard including column names row
At least an option to let this copy to clipboard behavior.
This way when copying a grid to an spreadsheet the column names would appear.
3. A kind of ReadCol function
A function to read a column (or part of it)
It could be like this:
Vector<Value> ReadCol(GridCtrl& grid, int col, int begin, int end)
{
if (begin < 0 || end >= grid.GetRowCount() || col < 0 || col >= grid.GetColumnCount())
throw Exc(t_("Wrong param. in ReadCol"));
Vector<Value> v;
for(int i = begin; i <= end; i++)
v.Add(grid(i, col));
return v;
}
4. A kind of GetGridData/SetGridData functions
Some functions to set GridCtrl data to a Vector<Vector<Value> > and the opposite.
They could be like this:
Vector<Vector<Value> > GetGridData(GridCtrl& grid) {
Vector<Vector<Value> > data;
for (int row = 0; row < grid.GetRowCount()+1; ++row)
data.Add(grid.ReadRow(row));
return data;
}
void SetGridData(GridCtrl& grid, Vector<Vector<Value> > &data) {
grid.Clear(true);
if (!data.IsEmpty()) {
int nrow = data.GetCount();
int ncol = data[0].GetCount();
for (int col = 0; col < data[0].GetCount(); ++col)
grid.AddColumn(data[0][col]);
grid.SetRowCount(data.GetCount()-1);
for (int row = 0; row < grid.GetRowCount(); ++row)
for (int col = 0; col < grid.GetColumnCount(); ++col)
grid(row, col) = data[row+1][col];
}
}
5. Xmlize
A simple implementation could be like this
template <> void Xmlize(XmlIO xml, GridCtrl& r) {
Vector<Vector<Value> > data;
if(xml.IsLoading()) {
xml("data", data);
SetGridData(r, data);
} else {
data = GetGridData(r);
xml("data", data);
}
}
Best regards
IƱaki
|
|
|
|
|
Some petitions for GridCtrl
By: koldo on Tue, 29 June 2010 11:11
|
|
|
Re: Some petitions for GridCtrl
By: unodgs on Thu, 01 July 2010 14:35
|
|
|
Re: Some petitions for GridCtrl
By: koldo on Tue, 06 July 2010 20:37
|
|
|
Re: Some petitions for GridCtrl
By: unodgs on Mon, 19 July 2010 00:51
|
|
|
Re: Some petitions for GridCtrl
By: ratah on Mon, 19 July 2010 09:26
|
|
|
Re: Some petitions for GridCtrl
By: unodgs on Tue, 20 July 2010 00:03
|
|
|
Re: Some petitions for GridCtrl
By: ratah on Wed, 21 July 2010 14:00
|
|
|
Re: Some petitions for GridCtrl
By: ratah on Mon, 19 July 2010 09:28
|
|
|
Re: Some petitions for GridCtrl
By: koldo on Mon, 19 July 2010 22:53
|
|
|
Re: Some petitions for GridCtrl
By: koldo on Mon, 26 July 2010 17:42
|
|
|
Re: Some petitions for GridCtrl
By: unodgs on Thu, 29 July 2010 00:01
|
|
|
Re: Some petitions for GridCtrl
By: koldo on Thu, 29 July 2010 08:47
|
|
|
Add a control into the GridCtrl
By: ratah on Fri, 16 July 2010 09:37
|
|
|
Re: Add a control into the GridCtrl
By: unodgs on Sun, 18 July 2010 23:12
|
|
|
Re: Some petitions for GridCtrl
By: sevenjay on Fri, 24 September 2010 13:21
|
|
|
Re: Some petitions for GridCtrl
By: sevenjay on Sun, 26 September 2010 04:18
|
|
|
Re: Some petitions for GridCtrl
By: unodgs on Mon, 27 September 2010 19:06
|
|
|
Re: Some petitions for GridCtrl
By: koldo on Thu, 30 September 2010 10:52
|
|
|
Re: Some petitions for GridCtrl
|
Goto Forum:
Current Time: Thu Sep 19 03:28:11 CEST 2024
Total time taken to generate the page: 0.03406 seconds
|