Known Issue:Ideally the main windows should get shown after the splash windows destroyed,but right at this moment I don't know how to make it,so in this version the main windows is visible also when the splash window get shown at program startup.I just make the size of the splash windows bigger than the main window to hide this issue.Will fix it in the future version.
main.ec
Code: Select all
import "ecere"
import "splash"
class Form1 : Window
{
text = "Form1";
background = activeBorder;
borderStyle = sizable;
hasMaximize = true;
hasMinimize = true;
hasClose = true;
size = { 328, 192 };
anchor = { horz = -239, vert = -205 };
nativeDecorations = true;
Label label1 { this, text = "程序主界面", foreground = green, font = { "Tahoma", 26, bold = true }, size = { 284, 61 }, position = { 16, 24 } };
Button btnExit
{
this, text = "(X)退出", altX, size = { 74, 21 }, position = { 216, 112 };
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
Destroy(0);
return true;
}
};
Button btnShowInfo
{
this, text = "(S)显示信息", altS, position = { 56, 112 };
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
MessageBox {text="test",contents="Test splash windows";}.Modal();
return true;
}
};
}
/*
class App:GuiApplication
{
bool Init()
{
splash.Create();
mainForm.Create();
return true;
}
}
*/
Splash splash {master=mainForm};
Form1 mainForm {visible=false;};
Code: Select all
import "ecere"
class Splash : Window
{
int i;
i=5;
text = "Form2";
background = activeBorder;
size = {800, 600 };
anchor = { horz = -56, vert = -88 };
isModal=true;
Label label1 { this, text = "闪屏测试", foreground = teal, font = { "Tahoma", 26, bold = true }, size = { 284, 37 }, position = { 248, 216 } };
Label label2 { this, text = "Are you ready?", foreground = teal, font = { "Tahoma", 26, bold = true }, size = {300, 45 }, position = { 248, 264 } };
Label label3 { this, text = "5", foreground = teal, font = { "Tahoma", 80, bold = true }, size = {300, 200}, position = { 350, 320 } };
Timer timer
{
userData = this, started = true, delay = 1;
bool DelayExpired()
{
char msg[2];
sprintf(msg,"%d",--i);
label3.text=msg;
Update(null);
if(i==0) this.Destroy(0);
return true;
}
void OnDestroy(void)
{
master.visible=true;
}
};
}