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 » U++ Widgets - General questions or Mixed problems » AlignDisplay bug (?)
AlignDisplay bug (?) [message #6660] Wed, 22 November 2006 01:33 Go to next message
zsolt is currently offline  zsolt
Messages: 697
Registered: December 2005
Location: Budapest, Hungary
Contributor
The base Display class draws text vertically centered. This would be nice for AlignDisplay also, but renders text to its top.
I changed AlignDisplay to render text vertically centered:
In TDraw/Util.cpp, the last two lines are my changes:
void AlignDisplay::Paint(Draw& draw, const Rect& rc, const Value& v, Color ink, Color paper, dword style) const
{
	String s = StdFormat(v);
	Font font = StdFont();
	Size size = GetTextSize(s, font);
	draw.DrawRect(rc, paper);
	int x = rc.left;
	switch(align)
	{
	case ALIGN_CENTER: x += (rc.Width() - size.cx) >> 1; break;
	case ALIGN_RIGHT:  x = rc.right - size.cx; break;
	}
	int y = rc.top + max((rc.Height() - size.cy) / 2, 0);
	draw.DrawText(x, y, s, font, ink);
}
Re: AlignDisplay bug (?) [message #6665 is a reply to message #6660] Wed, 22 November 2006 10:40 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
OK, I have altered Tom Wink

Actually, I am still not quite sure what to do with T* packages - they contain both candidate stuff for inclusion into "canonical" U++ packages (e.g. Draw), the legacy stuff that is kept to keep old apps compile and quite often, simply Tom's additions to U++ I do not quite like or simply do not know about Wink

(AlignDisplay is in the first and the very last category Smile

Mirek
Re: AlignDisplay bug (?) [message #6699 is a reply to message #6665] Thu, 23 November 2006 18:48 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I moved AlignDisplay to the Draw, but on the second though, would not it be easier to simply add this to StdDisplay?

Plus maybe AttrText?

Mirek
Re: AlignDisplay bug (?) [message #6704 is a reply to message #6699] Thu, 23 November 2006 19:14 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 697
Registered: December 2005
Location: Budapest, Hungary
Contributor
It would be nice Smile
Re: AlignDisplay bug (?) [message #6710 is a reply to message #6704] Fri, 24 November 2006 00:43 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
OK, changed. Display is now pure virtual... (may cause problems).

Mirek
Re: AlignDisplay bug (?) [message #6711 is a reply to message #6710] Fri, 24 November 2006 00:52 Go to previous message
zsolt is currently offline  zsolt
Messages: 697
Registered: December 2005
Location: Budapest, Hungary
Contributor
Thank you Smile
We will test it next week, I think Wink
Previous Topic: DropList bug
Next Topic: Mouse wheel and TopWindow
Goto Forum:
  


Current Time: Fri May 03 11:41:22 CEST 2024

Total time taken to generate the page: 0.02144 seconds