Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous message
koldo is currently offline  koldo
Messages: 3365
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
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Paste column in GridCtrl
Next Topic: How to add HeaderCtrl to DocEdit?
Goto Forum:
  


Current Time: Fri May 17 12:09:02 CEST 2024

Total time taken to generate the page: 0.02303 seconds