Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » problems with ArrayCtrl and SetFont
problems with ArrayCtrl and SetFont [message #24065] |
Wed, 23 December 2009 21:49  |
mubeta
Messages: 77 Registered: October 2006
|
Member |
|
|
Hi,
U++ 1713.
If I add values in an ArrayCtrl, using AttrText() for change the default font, I get the followings problems:
1) The value in the cell will be Null when edit it;
2) After end edit the cell, the font of this cell will be again the default font.
If I add values without AttrText() the editors working as well.
Following an short demo code:
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
GUI_APP_MAIN
{
ArrayCtrl a;
Array<EditString> es;
a.AddColumn("Text1").Edit(es.Add().SetFont(Courier(11)));
a.AddColumn("Text2").Edit(es.Add().SetFont(Courier(11)));
for(int i = 0; i < 10; i++)
//a.Add(AttrText(AsString(i)).SetFont(Courier(11)),
// AttrText(AsString(i*-1)).SetFont(Courier(11))
//);
a.Add(AsString(i),
AsString(i*-1)
);
a.SetLineCy(Draw::GetStdFontCy() + 4);
TopWindow app;
app.Add(a.SizePos());
app.Sizeable();
app.Run();
}
bye
Mauro Bottizzo.
|
|
|
Re: problems with ArrayCtrl and SetFont [message #24071 is a reply to message #24065] |
Thu, 24 December 2009 11:02  |
 |
mirek
Messages: 14256 Registered: November 2005
|
Ultimate Member |
|
|
mubeta wrote on Wed, 23 December 2009 15:49 | Hi,
U++ 1713.
If I add values in an ArrayCtrl, using AttrText() for change the default font, I get the followings problems:
1) The value in the cell will be Null when edit it;
2) After end edit the cell, the font of this cell will be again the default font.
If I add values without AttrText() the editors working as well.
Following an short demo code:
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
GUI_APP_MAIN
{
ArrayCtrl a;
Array<EditString> es;
a.AddColumn("Text1").Edit(es.Add().SetFont(Courier(11)));
a.AddColumn("Text2").Edit(es.Add().SetFont(Courier(11)));
for(int i = 0; i < 10; i++)
//a.Add(AttrText(AsString(i)).SetFont(Courier(11)),
// AttrText(AsString(i*-1)).SetFont(Courier(11))
//);
a.Add(AsString(i),
AsString(i*-1)
);
a.SetLineCy(Draw::GetStdFontCy() + 4);
TopWindow app;
app.Add(a.SizePos());
app.Sizeable();
app.Run();
}
bye
Mauro Bottizzo.
|
Yes, this a feature, not a bug...
AttrText is sort of special hack if you need to display something in color/font. It is special a special type of Value and cannot be edited.
To achieve what you need, you have to use proper Display to change the appearance of cell instead of AttrText.
Mirek
|
|
|
Goto Forum:
Current Time: Tue Apr 29 21:59:13 CEST 2025
Total time taken to generate the page: 0.00848 seconds
|