Code: Select all
import "ecere"
class Form1 : Window
{
text = "RadioButton/CheckBox/DropBox示例";
background = activeBorder;
borderStyle = fixed;
hasMaximize = true;
hasMinimize = true;
hasClose = true;
tabCycle = true;
hasStatusBar = true;
menu = { };
size = { 344, 192 };
anchor = { horz = -143, vert = -101 };
nativeDecorations = true;
EditBox editBox1 { this, text = "editBox1", size = { 142, 19 }, position = { 16, 56 } };
DropBox dropBox1
{
this, text = "dropBox1", size = { 240, 24 }, position = { 16, 96 }; editText=false;
bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
{
this.statusBar.text=dropBox.currentRow.string;
return true;
}
};
Button ckReadOnly
{
this, text = "只读", background = white, position = { 192, 56 }, isCheckbox = true;
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
editBox1.readOnly=button.checked;
dropBox1.editText=!button.checked;
return true;
}
};
Button rdRed
{
this, text = "红色", size = { 58, 21 }, position = { 16, 16 }, isRadio = true;
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
editBox1.background=TheColor();
return true;
}
};
Button rdBlue
{
this, text = "兰色", size = { 64, 23 }, position = { 96, 16 }, isRadio = true;
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
editBox1.background=TheColor();
return true;
}
};
Button rdGreen
{
this, text = "绿色", size = { 72, 23 }, position = { 184, 16 }, isRadio = true;
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
editBox1.background=TheColor();
return true;
}
};
void Initalize()
{
FillDropBox();
dropBox1.currentRow=dropBox1.firstRow;
rdRed.checked=true;
ckReadOnly.checked=true;
editBox1.background=red;
statusBar.borderStyle=deep;
editBox1.readOnly=true;
dropBox1.editText=false;
}
Form1()
{
Initalize();
}
void FillDropBox()
{
int i;
for(i=0;i<10;i++)
{
dropBox1.AddStringf("花好月圆%d",i+1);
}
}
Color TheColor()
{
if(rdRed.checked) return red;
else if(rdBlue.checked) return blue;
else return green;
}
}
Form1 form1 {};