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
Weird problem [message #35180] Thu, 19 January 2012 20:54 Go to next message
mdelfede is currently offline  mdelfede
Messages: 1264
Registered: September 2007
Senior Contributor
		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);


Z:\home\massimo\sources\upp-svn\UppCad\UppCadControls\Layers .cpp(60) : error C2039: 'DrawText' : is not a member of 'Upp::Draw'
Z:\home\massimo\sources\upp-svn\uppsrc\Draw/Draw.h(406) : see declaration of 'Upp::Draw'

Of course, DrawText IS a member of draw.... I can't find any mistake, but don't compile on MSC9. On Linux all OK....

Max
Re: Weird problem [message #35182 is a reply to message #35180] Thu, 19 January 2012 22:44 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3248
Registered: August 2008
Senior Veteran
Hello Massimo

I have tried this and compiles well with MSC9.

Could you simplify more the testcase?

struct Pru {
	Color color;
	String name;
};

void MyClass::Paint(Draw& w) {
	Rect r, cRect, tRect;
	Pru ld;
	int yTop = 0;
	int yBottom = 0;
	
	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);


Best regards
Iñaki
Re: Weird problem [message #35183 is a reply to message #35182] Thu, 19 January 2012 23:04 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1264
Registered: September 2007
Senior 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
Re: Weird problem [message #35184 is a reply to message #35183] Fri, 20 January 2012 08:23 Go to previous message
koldo is currently offline  koldo
Messages: 3248
Registered: August 2008
Senior Veteran
Sorry Massimo

I have tried it with MSC9 and MSC10 both 32 bits in XP and it has compiled well.


Best regards
Iñaki
Previous Topic: Creation of a static .lib with MSC in U++
Next Topic: diff/patch for Strings
Goto Forum:
  


Current Time: Sat Jan 23 08:34:14 CET 2021

Total time taken to generate the page: 0.00742 seconds