procedure
TForm1.btnNewClick(Sender: TObject);
var
NewForm: TForm2;
begin
if nil = FindCreateForm('TForm2') then
//띄워져있는 폼을
검사, nil이 아닐경우 해당폼이 이미 있음
begin
//해당 폼이 없을
경우 밑의 소스 실행
Application.CreateForm(TForm2, NewForm);
NewForm.Show;
end;
end;
//특정 Form의 이름을 받아 그 Form이 실행되는지를 검사
function
TFormFlowAnalysis.FindCreateForm(const AClassName: string): TForm;
var
i: Integer;
begin
Result:= nil;
for i:=0 to Screen.FormCount-1 do //화면에 띄워진 Form의 갯수만큼.
begin
if 0 <>
CompareText(Screen.Forms[i].ClassName, AClassName) then Continue;
//파라메터로 받아온
이름의 Form이 띄워져 있다면.
Result:= Screen.Forms[i];//그 Form을 반환
Break;
end;
end;
'Delphi' 카테고리의 다른 글
[Delphi] 레스트리에 값(키 아님) 읽고, 쓰고, 지우기 (0) | 2011.12.26 |
---|---|
[Delphi] 델파이에서 휠마우스의 휠 사용해서 스크롤 움직이기. (0) | 2011.10.31 |
[Delphi] 델파이에서 if문 사용시 주의 할점. (0) | 2011.10.31 |
[Delphi] 프로퍼티(property) (0) | 2011.10.17 |
[Delphi] 델파이 포인터. (0) | 2011.10.17 |