Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » ArrayCtrl and converters
ArrayCtrl and converters [message #27513] |
Wed, 21 July 2010 16:25 |
mubeta
Messages: 77 Registered: October 2006
|
Member |
|
|
Hi all,
(I am not a C++ developer, so I use U++ for write my applications).
I am using ArrayCtrl for show some variables readed from an external device connected via bus.
These variables should be formatted in various mode: decimal, hexadecimal and binary.
ArrayCtrl offer, (what I found), two way: 1) column editor that can can be one of many offered from U++ or self made with own converter; 2) cell editor, with the same peculiarity of the point 1).
My problem: I want to list my vars not in columns, but I rows, so, for the same column, but different row, I have to connect the cell with and different editor, using SetCtrl(..).
The problem is: Now my vars can be showed in lot of format: binary, decimal, hexadecimal, but they are also editable, and I don't want this. The editor can be disabled, yes, but it change is color and is not so easy for read the value.
Question:
1) How I can connect every single cell to an different converter, not editable?
2) How I can chenge this converter in runtime?
Hope for some help.
Thanks.
-
Attachment: Immagine.png
(Size: 10.44KB, Downloaded 478 times)
|
|
|
Re: ArrayCtrl and converters [message #27514 is a reply to message #27513] |
Wed, 21 July 2010 16:41 |
mrjt
Messages: 705 Registered: March 2007 Location: London
|
Contributor |
|
|
Firstly, instead of using Disable on the EditCtrls you could use ReadOnly and ClearFrames to get what you want.
But I'm pretty you actually want to use ArrayCtrl::SetDisplay. You can even link it to any Convert classes you have:
template<class T>
class ConvertDisplay : public Display
{
private:
T convert;
public:
virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const
{
Display &d = StdDisplay();
d.PaintBackground(w, r, q, ink, paper, style);
d.Paint(w, r, convert.Format(q), ink, paper, style);
}
};
// For instance:
typedef ConvertDisplay<ConvertHex> DisplayHex;
(untested, but the principle is sound)
|
|
|
|
Goto Forum:
Current Time: Thu Mar 28 15:26:22 CET 2024
Total time taken to generate the page: 0.01183 seconds
|