Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » Handle editable value in GridCtrl
Handle editable value in GridCtrl [message #23952] |
Wed, 09 December 2009 17:03  |
 |
koldo
Messages: 3432 Registered: August 2008
|
Senior Veteran |
|
|
Hello Uno
I wanted to derive GridCtrl to have a very basic SpreadSheet control.
To get that, I wanted to keep per cell the formula and the value to be visualized.
The behavior should be: If the cursor is in the cell, the formula is visualized and if not, the value is visualized.
I have tried some ways but without success:
- To prepare a Cell class with members value (Value) and formula (String).
Every cell in the GridCtrl is set a Cell, like in
grid.Set(23, 45, Cell(5, "2+3"));
This is slow for big GridCtrls
And Cell class has:
operator Value() { return RawToValue<Cell>(*this); }
A Convert class is used to visualize the value:
Value Format(const Value &q) const {
if (q.IsNull())
return Null;
else if (IsTypeRaw<Cell>(q)) {
const Cell &pv = ValueTo<Cell>(q);
return pv.value;
} else
return "Unknown";
}
But I do not know how to show the formula when the cursor is in the cell, and how to get the edited value to be set in the Cell formula member.
- To have an Array <Cell> like previous (without value as value is itself in the GridCtrl)
But I have the same problem: I do not know to show the formula and not the value when the cursor is in the cell.
Do you have any idea ?
Best regards
Koldo
Best regards
Iñaki
|
|
|
|
|
Re: Handle editable value in GridCtrl [message #23977 is a reply to message #23958] |
Sun, 13 December 2009 21:51  |
|
Hi!
Very interesting problem. I tried to do it using similar to yours approach but I failed too. I think I'll introduce new API to handle this problem. I won't give you any details right now but expect it very soon.
|
|
|
Goto Forum:
Current Time: Wed Apr 30 01:57:09 CEST 2025
Total time taken to generate the page: 0.02710 seconds
|