有一个按钮,开始是不可用的,但是我在选择combobox1和combobox2后就可以用了,请这个过程该怎样实现啊???
解决方案 »
- delphi MDI 子窗体关闭后再打开报错,请大家看看什么原因
- 请问我在查询数据库中的报表时,其中有字段为2009/08/05,如果在edit中输入2009/08/05时,查询2009/08的所有内容?
- 用delphi写的安装程序怎么在添加删除程序里面出现?
- 高手看看哪里有错
- 怎么在drawgrid中写文字?
- 怎样暂停递归,去打开另一个窗口?
- 谁能提供一个比较好的卷动盒控件?
- 在窗体上置控件speedbutton和panel,怎样实现将鼠标移上speedbutton时panel显示,鼠标离开speedbutton时panel隐藏? 要求:只能在speedbutton
- 讨论一下如何对Delphi源代码进行管理控制
- delphi DLL使用两个PCHAR参数出错
- 〉〉〉如何读取、写入sql server中的二进制数据?????
- 怎样在应用程序里调用软键盘? 在线等!!!
combobox1的OnEnter事件中写:
Button1.Enabled:=True;
Combobox1的onExit事件中写:
Button1.Enabled:=False;Combobox2的OnEnter事件指向Combobox1的OnEnter事件
combobox2的OnExit事件指向Combobox1的OnExit事件
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
if ComboBox1.ItemIndex=1 then
button1.Enabled:=true;
if ComboBox1.ItemIndex=0 then
button1.Enabled:=false;
end;
第一:先创一个窗体级的变量
t1,t2:boolean;第二:初如化,使BUTTON1不可用,且二个标识为假
procedure TForm1.FormCreate(Sender: TObject);
begin
t1:=false;
t2:=false;
button1.Enabled:=false;
end;
第三:
设CHANGE事件,一个组件变化后,一个标识为真,当全为真时就BUTTON1有效
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
t1:=true;
if t1 and t2 then
button1.Enabled:=true;
end;procedure TForm1.ComboBox2Change(Sender: TObject);
begin
t2:=true;
if t1 and t2 then
button1.Enabled:=true;
end;