Code: Select all import "ecere"
class Form1 : Window
{
text = "红绿灯traffic lights";
background = activeBorder;
borderStyle = sizable;
hasMaximize = true;
hasMinimize = true;
hasClose = true;
size = { 344, 224 };
anchor = { horz = -127, vert = -68 };
BitmapResource red{"red.png"};
BitmapResource blue{"blue.png"};
Timer timer
{
userData = this, started = false, delay = 1;
bool DelayExpired()
{
if (button1.checked)
{
button2.checked=true;
button2.Activate();
}
else
{
button1.checked=true;
button1.Activate();
}
Update(null);
return true;
}
};
Button button3
{
this, text = "开始start", position = { 256, 56 };
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
if(timer.started)
{
button3.text = "开始start";
timer.started = false;
}
else
{
button3.text = "停止stop";
timer.started = true;
}
return true;
}
};
Picture picture1 { this, text = "picture1", background = white, position = { 48, 56 } };
Button button1
{
this, text = "红灯red light", background = white, position = { 176, 56 }, isRadio = true;
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
picture1.image= red;
return true;
}
bool NotifyActivate(Window window, bool active, Window previous)
{
picture1.image= red;
return true;
}
};
Button button2
{
this, text = "绿灯blue light", position = { 176, 96 }, isRadio = true;
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
picture1.image = blue;
return true;
}
bool NotifyActivate(Window window, bool active, Window previous)
{
picture1.image = blue;
return true;
}
};
}
Form1 form1 {};
|