掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
イベントを使用しているコンポーネントの特定 (ID:42300)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
当方Delphi2005で他のバージョンで動作するか不明ですが、 usesにTypInfoを追加して procedure GetComponentEvent(const Owner: TForm; const Component: TComponent); var i, Count: Integer; PropList: PPropList; PropInfo: TPropInfo; PropValue: TMethod; begin PropList := nil; Count := GetPropList(Component, PropList); try //プロパティの数だけループ for i := 0 to Count - 1 do begin PropInfo := PropList[i]^; //プロパティがイベントの時 if PropInfo.PropType^.Kind = tkMethod then begin PropValue := GetMethodProp(Component, PropInfo.Name); if PropValue.Code <> nil then begin ShowMessageFmt('%s.%s = %s', [Component.Name, PropInfo.Name, Owner.MethodName(PropValue.Code)]); end; end; end; finally if PropList <> nil then FreeMem(PropList); end; end; procedure TForm1.Button1Click(Sender: TObject); var i: Integer; begin //フォームのイベントがあれば取得 GetComponentEvent(Self, Self); //フォーム上のコントロールのイベントを取得 for i := 0 to ComponentCount - 1 do begin GetComponentEvent(Self, Components[i]); end; end;
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.