Do not panic. Ask here before giving up.
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
Hello Uno Perhaps other focus would be to have an EditString that would appear on the selected cell when double clicked. The problem I have is that I do not know the location of the double-clicked cell to fit on it the EditString. In the screenshot the cell with "20" has been double clicked, the EditString is filled with the right formula (12+8 = 20), but it should be moved and sized on the selected cell. Best regards Koldo
Hello Uno Following the last option I have found the function GetItemRect(row, col) that returns the Rect of the cell indicated. The bad thing is that it is private and that I will have to find something to resize the EditString over the cell when resizing the column. Best regards Koldo
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.