Delphi Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
델파이 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
FreePascal/Lazarus
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
델마당
볼랜드포럼 광고 모집

델파이 Q&A
Delphi Programming Q&A
[10163] Re: 해결했습니다.
김대정 [daedalus] 1094 읽음    2005-07-23 14:21
//ClassName이라는 속성을 이용하면 되더군요. 
function TFormMain.CheckActiveForm(sClass : string): boolean;
var
s : ShortString;
begin

    if ActiveMdiChild <> nil  then
    begin
        if sClass = ActiveMdiChild.ClassName then
        begin
            ActiveMdiChild.WindowState := wsMaximized;
            Result := true;
            Exit;
        end else
            ActiveMdiChild.Close;
    end;
    Result := false;
end;




김대정 님이 쓰신 글 :
: 예를들어 이런 코드를 만들려고 합니다.
:
: 원래는 아래와 같은 코드인데요
:
: procedure TFormMain.mnuLessonsClick(Sender: TObject);
: var
:   f: TFormLessons;
: begin
:   //이미 있는 폼이 해당 폼이면 최대화시키고
:   //아니면 종료시키고 새 폼을 만든다.
:   if ActiveMDIChild <> nil then
:   begin
:     if ActiveMdichild is TFormLessons then
:     begin
:       ActiveMdiChild.WindowState := wsMaximized;
:       Exit;
:     end else
:      ActiveMDIChild.Close;
:   end;
:
:   //새 폼을 만든다.
:   f := TFormLessons.Create(self);
:   f.WindowState := wsMaximized;
: end;
:
:
: 이런 코드를 아래와 같이 만들려고 합니다.
:
:
: function TFormMain.CheckActiveForm(_t : type): boolean;
: begin
:   if ActiveMDIChild <> nil then
:   begin
:     if ActiveMdichild is _t then
:     begin
:       ActiveMdiChild.WindowState := wsMaximized;
:       Result := true;
:       Exit;
:     end else
:      ActiveMDIChild.Close;
:   end;
:   Result := false;
: end;
:
: procedure TFormMain.mnuLessonsClick(Sender: TObject);
: var
:   f: TFormLessons;
: begin
:   //이미 있는 폼이 해당 폼이면 최대화시키고
:   //아니면 종료시키고 새 폼을 만든다.
:     if  CheckActiveForm (TFormLessons)  then
:       Exit;
:
:   //새 폼을 만든다.
:   f := TFormLessons.Create(self);
:   f.WindowState := wsMaximized;
: end;
:
:
: 헌데 함수 파라미터에  type이름을 넘기는 방법을 모르겠습니다. 
: 함수선언시에
: (_t : type)
: 이 부분에서 에러가 납니다.
:
: 그리고  혹시나
: c++의  #define과  매크로가 델파이에 있나요?

+ -

관련 글 리스트
10162 type 이름을 함수 파라미터로 넘길수 있나요? 김대정 922 2005/07/23
10163     Re: 해결했습니다. 김대정 1094 2005/07/23
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.