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 |
mdelfede
Messages: 1308 Registered: September 2007
|
Ultimate 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 |
|
koldo
Messages: 3394 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 |
mdelfede
Messages: 1308 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
|
|
|
Re: Weird problem [message #35184 is a reply to message #35183] |
Fri, 20 January 2012 08:23 |
|
koldo
Messages: 3394 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
|
|
|
Goto Forum:
Current Time: Sat Sep 21 02:41:45 CEST 2024
Total time taken to generate the page: 0.03295 seconds
|