关于CHEECKBOX的选取问题 |
答題得分者是:老大仔
|
zhouying82
高階會員 發表:150 回覆:272 積分:189 註冊:2004-03-16 發送簡訊給我 |
我代码如下 if checkbox1.checked then if opendialog1.execute then label1.caption:=opendialog1.filename; end; .... 现在我想实现的功能就是,当我执行下面的代码 label1.caption:=extractfilename(application.exename) 'hello.mp3'; 也希望checkbox1.checked为选中,但是不弹出OPENDIALOG的对话框,有没有什么办法?
------
断断续续的学了几年,还是一个初学者,永远支持Delphi ! |
max5020
資深會員 發表:30 回覆:277 積分:321 註冊:2003-06-04 發送簡訊給我 |
設一個Bool_var來加以判定就好了
===================引 用 zhouying82 文 章=================== 我代码如下 if checkbox1.checked then if Bool_Var then if opendialog1.execute then label1.caption:=opendialog1.filename; end; .... 现在我想实现的功能就是,当我执行下面的代码 label1.caption:=extractfilename(application.exename) 'hello.mp3'; 也希望checkbox1.checked为选中,但是不弹出OPENDIALOG的对话框,有没有什么办法?
Procedure Button1.onClick(Sender) begin Bool_var:= false; CheckBox1.Checked:= true; end;
編輯記錄
max5020 重新編輯於 2009-05-14 15:03:04, 註解 無‧
|
老大仔
尊榮會員 發表:78 回覆:837 積分:1088 註冊:2006-07-06 發送簡訊給我 |
請把
if CheckBox1.Checked then if OpenDialog1.Execute then Edit1.Text:=OpenDialog1.FileName 寫在CheckBox1的onmouseup中即可 你可以試看看寫在onClick和onMouseUp的差別 [code delphi] procedure TForm1.CheckBox1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin if CheckBox1.Checked then if OpenDialog1.Execute then Edit1.Text:=OpenDialog1.FileName end; procedure TForm1.Button1Click(Sender: TObject); begin if Checkbox1.Checked then CheckBox1.Checked := False else CheckBox1.Checked := True; end; [/code] |
zhouying82
高階會員 發表:150 回覆:272 積分:189 註冊:2004-03-16 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |