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

自製的元件屬性可不可以只抓取某一類別的元件?

尚未結案
PhotoRGB
一般會員


發表:3
回覆:5
積分:1
註冊:2002-08-17

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-09-01 00:39:21 IP:211.76.xxx.xxx 未訂閱
以下只截錄該屬性部份… 目前FActionEdit這個屬性在設定時會連其他屬於TWinControl類別的元件都抓出來, 可不可以只抓屬於TEdit類別的元件呢? 我把TWinControl改成TEdit之後連一個元件都抓不到,有人可以提供方法解決嗎? 謝謝! : 略 : private FActionEdit: TWinControl; procedure SetActionEdit(Value: TWinControl); published property ActionEdit: TWinControl read FActionEdit write SetActionEdit; : 略 : procedure ActionSQL.SetActionEdit(Value: TWinControl); begin FActionEdit:= Value; if Value <> nil then Value.FreeNotification(Self); end;
speedup
資深會員


發表:19
回覆:259
積分:280
註冊:2003-07-04

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-09-02 09:52:18 IP:220.139.xxx.xxx 未訂閱
引言: private FActionEdit: TEdit;//不一定要改 procedure SetActionEdit(Value: TEdit); published property ActionEdit: TEdit read FActionEdit write SetActionEdit; : 略 : procedure ActionSQL.SetActionEdit(Value: TEdit); begin FActionEdit:= Value; if Value <> nil then Value.FreeNotification(Self); end;
混心雜欲 棄修身~唉
------
唉~
te_hsun
一般會員


發表:43
回覆:34
積分:20
註冊:2002-03-25

發送簡訊給我
#3 引用回覆 回覆 發表時間:2005-09-02 09:57:53 IP:218.168.xxx.xxx 未訂閱
private      FActionEdit: TCustomEdit;
  procedure SetActionEdit(Value: TCustomEdit);
  function GetActionEditText: string;
  procedure SetActionEditText(const Value: string);    protected      procedure Notification(AComponent: TComponent; Operation: TOperation); override;    published      property ActionEdit: TCustomEdit read FActionEdit write SetActionEdit;
  property ActionEditText: string read GetActionEditText write SetActionEditText;    end;    implementation    procedure ActionSQL.SetActionEdit(Value: TCustomEdit);
begin
  FActionEdit:= Value;
  if Value <> nil then Value.FreeNotification(Self);
end;    procedure ActionSQL.Notification(AComponent: TComponent; Operation: TOperation);
begin
  inherited Notification(AComponent, Operation);
  if (Operation = opRemove) and (AComponent = FActionEdit) then
    FActionEdit:= nil;
end;    function ActionSQL.GetActionEditText: string;
begin
  Result:= FActionEdit.Text;
end;    procedure ActionSQL.SetActionEditText(const Value: string);
begin
  FActionEdit.Text:= Value;
end;
發表人 - te_hsun 於 2005/09/02 10:08:30
PhotoRGB
一般會員


發表:3
回覆:5
積分:1
註冊:2002-08-17

發送簡訊給我
#4 引用回覆 回覆 發表時間:2005-09-03 00:13:28 IP:211.76.xxx.xxx 未訂閱
謝謝兩位大大熱心的解答,不過兩位的方法我都試過, 在挑元件時都會是空的,無法找到任何 TEdit 或其他的元件。
speedup
資深會員


發表:19
回覆:259
積分:280
註冊:2003-07-04

發送簡訊給我
#5 引用回覆 回覆 發表時間:2005-09-05 14:07:56 IP:220.139.xxx.xxx 未訂閱
你確定你放的是 TEdit元件 還是其他Third Party元件 混心雜欲 棄修身~唉
------
唉~
PhotoRGB
一般會員


發表:3
回覆:5
積分:1
註冊:2002-08-17

發送簡訊給我
#6 引用回覆 回覆 發表時間:2005-09-06 20:15:27 IP:211.76.xxx.xxx 未訂閱
是 TEdit 元件沒錯,我自製的元件是繼承 TAdoQuery, 繼承的元件對屬性的設定有影響嗎?
te_hsun
一般會員


發表:43
回覆:34
積分:20
註冊:2002-03-25

發送簡訊給我
#7 引用回覆 回覆 發表時間:2005-09-07 00:08:44 IP:218.168.xxx.xxx 未訂閱
我試了繼承 TAdoQuery 做一個元件 在Object Inspector中可以選取TEdit元件耶 是哪邊有問題呢? 還是你可以post一張問題圖片上來看看... 發表人 - te_hsun 於 2005/09/07 00:10:21
PhotoRGB
一般會員


發表:3
回覆:5
積分:1
註冊:2002-08-17

發送簡訊給我
#8 引用回覆 回覆 發表時間:2005-09-07 09:55:11 IP:220.130.xxx.xxx 未訂閱
//原程式碼 unit openSQL;    interface    uses   Windows, Messages, SysUtils, Classes, DB, ADODB, QStdCtrls, Controls;    type   owSQL = class(TADOQuery)      private     { Private declarations }     FAllowEdit : Boolean;     FActionEdit: TCustomEdit;        procedure SetActionEdit(Value: TCustomEdit);      protected     { Protected declarations }     procedure Notification(AComponent: TComponent; Operation: TOperation); override;   public     { Public declarations }   published     { Published declarations }     Property AllowEdit :Boolean Read FAllowEdit Write FAllowEdit;     property ActionEdit : TCustomEdit read  FActionEdit write SetActionEdit;   end;    procedure Register;    implementation    procedure Register; begin   RegisterComponents('Samples', [owSQL]); end;    { owSQL }    procedure owSQL.Notification(AComponent: TComponent;   Operation: TOperation); begin   inherited Notification(AComponent, Operation);   if (Operation = opRemove) and (AComponent = FActionEdit) then     FActionEdit := nil; end;    procedure owSQL.SetActionEdit(Value: TCustomEdit); begin   FActionEdit := Value;   if Value <> nil then Value.FreeNotification(Self); end;    end.    上圖為上面程式碼的結果,下圖為我把TCustomEdit改成TWinControl的結果。
te_hsun
一般會員


發表:43
回覆:34
積分:20
註冊:2002-03-25

發送簡訊給我
#9 引用回覆 回覆 發表時間:2005-09-07 11:42:37 IP:218.168.xxx.xxx 未訂閱
unit openSQL;    interface    uses Windows, Messages, SysUtils, Classes, DB, ADODB, StdCtrls, Controls; . . .
PhotoRGB
一般會員


發表:3
回覆:5
積分:1
註冊:2002-08-17

發送簡訊給我
#10 引用回覆 回覆 發表時間:2005-09-07 17:48:59 IP:220.130.xxx.xxx 未訂閱
感謝te_hsun大大的解答,另外請教一個問題, 那些Library有Q跟沒Q的有什麼差別? 有Q的給QuickReport用的嗎?
te_hsun
一般會員


發表:43
回覆:34
積分:20
註冊:2002-03-25

發送簡訊給我
#11 引用回覆 回覆 發表時間:2005-09-07 20:10:12 IP:218.168.xxx.xxx 未訂閱
如果我沒弄錯 QStdCtrls 是給Kylix用的
系統時間:2024-05-19 13:04:24
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!