Code: Select all
class test : Window
{
Point pos;
Label label_1{
void TestFunction()
{
this.position = !!!; // how to access the Point pos here ?
}
}
}
Code: Select all
class test : Window
{
Point pos;
Label label_1{
void TestFunction()
{
this.position = !!!; // how to access the Point pos here ?
}
}
}
Code: Select all
class test : Window
{
Point pos;
Label label_1{ position = pos };
}
Code: Select all
test testObject = (test)master;
position = testObject.pos;
Code: Select all
void TestFunction(Label lbl)
Code: Select all
lbl.position = pos;
Code: Select all
label_1.position = pos;
Code: Select all
class TestWinow : Window
{
background = activeBorder;
opacity = 0.5f;
clientSize = { 576, 392 };
position = { 112, 72 };
alphaBlend = true;
Point deltaPos{0,0};
Label label1
{
this, caption = "label1", background = blue, 1, size = { 156, 85 }, position = { 160, 144 };
void OnRedraw(Surface surface)
{
this.position += deltaPos; ///error: unresolved identifier deltaPos; expected ecere::sys::Point
Label::OnRedraw(surface);
}
}
bool OnMouseMove(int x, int y, Modifiers mods)
{
deltaPos.x = x;
deltaPos.y = y;
return true;
};
}
TestWinow mainForm {};
I clicked the OnRedraw() method of label1 from IDE Methods window, then the IDE jumped to the definition of label1. so I didn't recognized that I couldn't change OnRedraw() there, but the IDE didn't give me any message on preventing me modifying itself.jerome wrote:Hi nicktick, did you just edit that post, or did I miss the TestFunction()?
You cannot add new methods to instances, you can only override virtual methods.
If the method is a regular virtual method
(e.g. virtual void OnMyVirtualMethod() -- This is for derivative controls to modify the behavior of 'this' control )
and the control has set its master to 'this' (The 'test' class).