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 » Extra libraries, Code snippets, applications etc. » C++ language problems and code snippets » Weird problem
Re: Weird problem [message #35183 is a reply to message #35182] Thu, 19 January 2012 23:04 Go to previous messageGo to previous message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Complete code is this one :

typedef struct
{
	bool frozen;
	bool locked;
	Color color;
	String name;
	
} LayerData;

class LayerDisplay : public Display
{
	private:
	
	protected:
	
	public:
		void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const;
};

void LayerDisplay::Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const
{
	// paint background
	w.DrawRect(r, White);
	
	// get rects of various parts of control
	int yMid = (r.top + r.bottom) / 2;
	int yTop = yMid - 10;
	int yBottom = yMid + 10;
	Rect fRect(r.left     , yTop, r.left + 20, yBottom);
	Rect lRect(r.left + 24, yTop, r.left + 44, yBottom);
	Rect cRect(r.left + 48, yTop, r.left + 68, yBottom);

	Rect tRect(r.left + 72, r.top, r.right, r.bottom);
	
	// recover data from value
	if(!q.IsNull())
	{
		LayerData const &ld = ValueTo<LayerData>(q);
		
		// paints the contents
		if(ld.frozen)
			w.DrawImage(fRect.Deflated(2), UppCadControlsImg::LayerOff());
		else
			w.DrawImage(fRect.Deflated(2), UppCadControlsImg::LayerOn());
		if(ld.locked)
			w.DrawImage(lRect.Deflated(2), UppCadControlsImg::LayerLocked());
		else
			w.DrawImage(lRect.Deflated(2), UppCadControlsImg::LayerUnlocked());

		w.DrawRect(cRect, ld.color);
		w.DrawLine(r.left + 48, yTop   , r.left + 68, yTop   , 0, Black);
		w.DrawLine(r.left + 68, yTop   , r.left + 68, yBottom, 0, Black);
		w.DrawLine(r.left + 68, yBottom, r.left + 48, yBottom, 0, Black);
		w.DrawLine(r.left + 48, yBottom, r.left + 48, yTop   , 0, Black);
		w.DrawText(tRect.left, tRect.top, ld.name);
	}
}


But even doing w.DrawText(0, 0, "abc") inside the function gives same result.... MSC9 under wine. Rest of program (some 1e6 code lines) compiles perfectly. On Linux also compiles perfectly.

Max
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Creation of a static .lib with MSC in U++
Next Topic: diff/patch for Strings
Goto Forum:
  


Current Time: Thu Apr 25 14:53:52 CEST 2024

Total time taken to generate the page: 0.02235 seconds