Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » Cells appearance and text alignment
|
|
|
Re: Cells appearance and text alignment [message #25195 is a reply to message #25193] |
Sat, 13 February 2010 19:27 |
mdelfede
Messages: 1308 Registered: September 2007
|
Ultimate Contributor |
|
|
Wellm first problem solved with SetDisplay() and NoEdit() :
class _StaticDisplay : public Display
{
public:
virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const
{
StdDisplay().Paint(w, r, q, SColorText(), SColorFace, 0);
}
};
Display const &StaticDisplay(void)
{
static _StaticDisplay disp;
return (Display const &)disp;
}
......................
loads.AddColumn("").Margin(0).SetDisplay(StaticDisplay()).NoEdit();
Ciao
Max
|
|
|
Re: Cells appearance and text alignment [message #25196 is a reply to message #25193] |
Sat, 13 February 2010 19:33 |
Sender Ghost
Messages: 301 Registered: November 2008
|
Senior Member |
|
|
mdelfede wrote on Sat, 13 February 2010 19:11 |
Anyways, if I've read well the docs, using AttrText makes it difficult to read back value from arrayctrl.
|
Not really. The AttrText struct is "raw value type" in ArrayCtrl.
For previous example you can use following code to display it:
int index = list.GetCursor();
AttrText data = ValueTo<AttrText>(list.Get(index, 1));
PromptOK(AsString(data.text));
After read your third message here:
Yes, there is other possibilities like using Display.
May be, hard tools are relative for this complex task.
[Updated on: Sat, 13 February 2010 19:46] Report message to a moderator
|
|
|
|
|
Re: Cells appearance and text alignment [message #25202 is a reply to message #25201] |
Sat, 13 February 2010 20:47 |
mdelfede
Messages: 1308 Registered: September 2007
|
Ultimate Contributor |
|
|
Hi Sender Ghost,
Sender Ghost wrote on Sat, 13 February 2010 20:33 |
mdelfede wrote on Sat, 13 February 2010 20:12 |
All works, but I can't disable/enable editing with an embedded control for selected cell(s).
Any way to do it ?
|
Try to use SetCtrl method of ArrayCtrl. Assign disabled and enabled ctrls to cells.
Also read about SetFormat and SetConvert methods for checks on valid characters.
|
Thank you, but it seems to me quite complicated... I must then keep an external array of controls in sync with ArrayCtrl when adding/removing rows.
It would be better to have this in ArrayCtrl.h :
Ctrl &GetEmbeddedCtrl(int i, int j) { return *GetCtrl(i, j).ctrl; }
I added it and it works fine, allowing enable/disable of embedded controls :
arrayCtrl.GetEmbeddedCtrl(line, col).Disable();
arrayCtrl.GetEmbeddedCtrl(line, col).Enable();
Mirek, would it be possible to have it added to main tree ?
The name is not the best, but GetCtrl() (which would be better...) is already used as a private function.
If not possible, it would be also enough a Enable(i, j)/Disable(i, j) pair, to allow single cell control of editing.
Last possibility.... make GetCtrl() protected, so I can derive from ArrayCtrl, if all above isnt' acceptable... Now it's private
Ciao
Max
[Updated on: Sat, 13 February 2010 20:51] Report message to a moderator
|
|
|
|
|
|
|
Goto Forum:
Current Time: Fri Sep 20 10:10:48 CEST 2024
Total time taken to generate the page: 0.02776 seconds
|