Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » Is it possible to set the Font type for the arrayctrl?
Re: Is it possible to set the Font type for the arrayctrl? [message #3852 is a reply to message #3840] |
Sat, 01 July 2006 09:38   |
 |
forlano
Messages: 1213 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
luzr wrote on Thu, 29 June 2006 20:16 |
And yes, you can of course use Display to change the font. Alternatively, you can use AttrText as Value to do the same.
Mirek
|
I believed it was easy, and maybe it is, but I was unable to set the font of the column of the array. Below there is the code that set in red some cell of the arrayctrl. Does anybody know how to modify it to set the font, say Curier, of the column using one of the method listed above by Mirek?
Thanks a lot.
Luigi
#include <CtrlLib/CtrlLib.h>
class NumbersOnRed : public Display
{
public:
static bool numberString(String s);
void PaintBackground(Draw& w, const Rect& r, const Value& q,
Color ink, Color paper, dword style) const;
};
bool NumbersOnRed::numberString(String s)
{
if(s.GetCount() == 0)
return false;
int i = 0;
if(s[0] == '+' || s[0] == '-')
i++;
while(i < s.GetCount() && s[i] >= '0' && s[i] <= '9')
i++;
return i == s.GetCount();
}
void NumbersOnRed::PaintBackground(Draw& w, const Rect& r, const Value& q,
Color ink, Color paper, dword style) const
{
if(IsNumber(q) || (IsString(q) && numberString(AsString(q))))
paper = Color(255, 150, 150);
Display::PaintBackground(w, r, q, ink, paper, style);
}
GUI_APP_MAIN
{
ArrayCtrl array;
array.AddColumn("value").SetDisplay(Single<NumbersOnRed>());
array.Add("test1");
array.Add("2test");
array.Add("3 test");
array.Add("4");
array.Add("test");
array.Add("-99");
TopWindow win;
win.Zoomable().Sizeable();
win.Add(array.SizePos());
win.Run();
}
|
|
|
 |
|
Is it possible to set the Font type for the arrayctrl?
By: forlano on Sat, 06 May 2006 14:56
|
 |
|
Re: Is it possible to set the Font type for the arrayctrl?
|
 |
|
Re: Is it possible to set the Font type for the arrayctrl?
|
 |
|
Re: Is it possible to set the Font type for the arrayctrl?
By: forlano on Sun, 07 May 2006 14:45
|
 |
|
Re: Is it possible to set the Font type for the arrayctrl?
By: forlano on Sun, 07 May 2006 19:44
|
 |
|
Re: Is it possible to set the Font type for the arrayctrl?
By: forlano on Wed, 28 June 2006 18:45
|
 |
|
Re: Is it possible to set the Font type for the arrayctrl?
By: mirek on Thu, 29 June 2006 20:16
|
 |
|
Re: Is it possible to set the Font type for the arrayctrl?
By: forlano on Sat, 01 July 2006 09:38
|
 |
|
Re: Is it possible to set the Font type for the arrayctrl?
By: mirek on Sun, 07 May 2006 19:53
|
 |
|
Re: Is it possible to set the Font type for the arrayctrl?
By: mirek on Sun, 09 July 2006 16:04
|
 |
|
Re: Is it possible to set the Font type for the arrayctrl?
By: forlano on Mon, 10 July 2006 15:46
|
 |
|
Re: Is it possible to set the Font type for the arrayctrl?
By: mirek on Mon, 10 July 2006 17:31
|
Goto Forum:
Current Time: Sun Aug 17 03:42:15 CEST 2025
Total time taken to generate the page: 0.04810 seconds
|