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 » problems with ArrayCtrl and SetFont
problems with ArrayCtrl and SetFont [message #24065] Wed, 23 December 2009 21:49 Go to next message
mubeta is currently offline  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 Go to previous message
mirek is currently offline  mirek
Messages: 13975
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
Previous Topic: DropGrid jump to row
Next Topic: Embed editfields in ArrayCtrl
Goto Forum:
  


Current Time: Thu Mar 28 21:31:58 CET 2024

Total time taken to generate the page: 0.01306 seconds