form1.ec
Code: Select all
import "ecere"
import "form2"
class Form1 : Window
{
text = "Form1";
background = activeBorder;
borderStyle = fixed;
hasMinimize = true;
hasClose = true;
size = { 488, 192 };
anchor = { horz = -31, vert = -133 };
nativeDecorations = true;
Button button1
{
this, text = "(N)ext", altN, position = { 416, 128 };
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
Form2 form2{};
form2.Create();
visible=false;
return true;
}
};
Picture picture1 { this, text = "picture1", anchor = { left = 16, top = 16, right = 16, bottom = 52 }, image = { "C:\\person\\ecere\\ecere\\ide\\res\\ecereBack.jpg" } };
float version;
public:
property float version
{
set{version=value;}
get{return version;}
}
char versionStr[32];
property char* versionStr
{
get
{
char result[32];
sprintf(result,"%.1f",version);
strcpy(versionStr,result);
return versionStr;
}
}
void OnRedraw(Surface surface)
{
char caption[40];
sprintf(caption,"MultiformApp-V%.1f",this.version);
this.text=caption;
}
}
Form1 form1 { version=1.0f; };
Code: Select all
import "ecere"
import "form1"
class Form2 : Window
{
text = "Form2";
background = activeBorder;
borderStyle = fixed;
hasMinimize = true;
hasClose = true;
size = { 520, 152 };
anchor = { horz = -28, vert = -140 };
nativeDecorations = true;
Button btnBack
{
this, text = "(B)ack", altB, position = { 424, 72 };
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
form1.visible=true;
Destroy(0);
return true;
}
};
master=form1;
bool OnClose(bool parentClosing)
{
form1.visible=true;
Destroy(0);
return true;
}
Label label1 { this, text = "label1", foreground = seaGreen, font = { "Tahoma", 16, bold = true, italic = true }, size = { 476, 45 }, position = { 16, 16 } };
bool OnPostCreate(void)
{
char str[40];
form1.version=form1.version+0.1f;
sprintf(str,"The latest version of form1 is %.1f",form1.version);
this.label1.text=str;
return true;
}
}