掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
ユニット分割について (ID:150026)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
Mr.XRAY 様。サンプルありがとうございます。 解読してみているんですが、classと言う物になじみが無いので難航中です(>_<) >質問者の意図を十分理解しているわけではありません. 意図としましては、メインフォームの指示で外部PASにて動的にフォームを生成し そのフォームのイベントを外部PAS内でキャッチしたい感じです。 メインフォーム ---------------------------------------- unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); end; var Form1: TForm1; implementation uses sample_module; {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin go(sender,self); end; end. ---------------------------------------- sample_module.pas ---------------------------------------- unit sample_module; interface uses Dialogs,forms,ExtCtrls,Graphics,Controls,Classes; procedure go(sender:tobject;form:tform); implementation procedure OnMouseDownEvent(********); begin end; procedure OnMouseMoveEvent(********); begin end; procedure go(sender:tobject;form:tform); var ti:timage; tf: TForm; begin tf:= TForm.Create(nil); tf.Caption := 'overlay1'; tf.FormStyle:=fsStayOnTop; tf.width:=200; tf.Height:=200; tf.Show; ti:=TImage.Create(nil); ti.Parent:=TForm(tf); ti.Transparent := True; ti.Canvas.Ellipse(0,0,100,100); //ti.OnMouseDown := OnMouseDownEvent; //ti.OnMouseMove := OnMouseMoveEvent; end; end. ---------------------------------------- >take様ありがとうございます。 >作ったFormは他のプロジェクトでも呼び出せるけど違うのかな? >条件コンパイルと、動的関数呼び出しを考えているのかな? 決まったフォームを呼び出したいという感じでは無く 動的に中身の違うフォームを引数に応じて作成したい感じです。 なので、中身にサードパーティーのコントロールを利用する関数を利用していた場合は 使う使わないに限らずにusesが必要になると思います。 イメージだと、コンポーネント一覧を表示しプロパティーをtypeinfoで表示しようとするとusesしていないコンポーネントの情報は表示されませんよね。なので全コンポーネントをusesするのも現実的では無いと思います。なので、一覧から選んだときのみ動的にusesさせるためには、ソースをテキストで持ちコマンドラインでusesと一覧する物を動的に生成し、データーとして出力し、その返り値を得るのではと考えた次第です。
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.