線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1364
推到 Plurk!
推到 Facebook!

Speedbutton 的Action

答題得分者是:william
cyl
中階會員


發表:163
回覆:171
積分:66
註冊:2002-07-11

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-01-17 14:23:59 IP:61.218.xxx.xxx 未訂閱
請問我使用Button,把Action此屬性設定為Action 的Datasetinsert,但是 我除了在Action要做一些事件外,我在Button click也要觸發一些事,但是很奇怪, 只要我在Button click或Action onexecute寫的任何事件會觸發,但是此時Button Action的atasetinsert 都不會執行,請問是為什麼???
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-01-17 14:39:38 IP:147.8.xxx.xxx 未訂閱
Here are the related code from VCL source:    
procedure TSpeedButton.Click;
begin
  inherited Click;
end;
{...}
procedure TControl.Click;
begin
  { Call OnClick if assigned and not equal to associated action's OnExecute.
    If associated action's OnExecute assigned then call it, otherwise, call
    OnClick. }
  if Assigned(FOnClick) and (Action <> nil) and (@FOnClick <> @Action.OnExecute) then
    FOnClick(Self)
  else if not (csDesigning in ComponentState) and (ActionLink <> nil) then
    ActionLink.Execute(Self)
  else if Assigned(FOnClick) then
    FOnClick(Self);
end;
Hence either the button click event handler or the action execute handler will be executed.
cyl
中階會員


發表:163
回覆:171
積分:66
註冊:2002-07-11

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-01-17 14:54:44 IP:61.218.xxx.xxx 未訂閱
Dear William 你說的意思是只要我在button中加入此 inherited Click;就好了嗎?? 而procedure TControl.Click;要加在哪裡呢??? 對不起我點不懂要如何修改???
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-01-17 15:09:08 IP:147.8.xxx.xxx 未訂閱
引言:Dear William 你說的意思是只要我在button中加入此 inherited Click;就好了嗎?? 而procedure TControl.Click;要加在哪裡呢??? 對不起我點不懂要如何修改???
Unless you want to build your own VCL, don't modify it... What I mean is you can only use either the click event or the action execute but NOT both at the same time.
系統時間:2024-06-28 22:44:15
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!