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

C++빌더 Q&A
C++Builder Programming Q&A
[23403] Re:Re:Re:답변에 감사드리며.. Collection에 대한 질문사항이 또 있어요..
제라툴 [] 712 읽음    2002-12-26 19:07
제가 말빨이 별루 좋지않아서. 간단한 컬랙션 예제 입니다.

Point를 저장하기 위해서 만든 클래스인데..^^

class TPointItem : public TCollectionItem
{
private:
    int Fx;
    int Fy;
    int FGroupIndex;
__published:
    __property int x  = { read=Fx, write=Fx };
    __property int y  = { read=Fy, write=Fy };
    __property int GroupIndex  = { read=FGroupIndex, write=FGroupIndex };
};
//------------------------------------------------------------------------
class TPoints : public TCollection
{
    typedef Classes::TCollection inherited;

private:
    HIDESBASE TPointItem* __fastcall GetItem(int Index);
    HIDESBASE void        __fastcall SetItem(int Index, TPointItem* Value);

protected:
public:
    __fastcall TPoints() : TCollection(__classid(TPointItem)){ };
    HIDESBASE TPointItem* __fastcall Add(void);
__published:
    __property TPointItem* Items[int Index] = {read=GetItem, write=SetItem};
};
//------------------------------------------------------------------------


//=================================================================
TPointItem* __fastcall TPoints::GetItem(int Index)
{
    return (TPointItem*)(inherited::GetItem(Index));
}
//---------------------------------------------------------------------------
void __fastcall TPoints::SetItem(int Index, TPointItem* Value)
{
    inherited::SetItem(Index, (TCollectionItem*)Value);
}
//---------------------------------------------------------------------------
TPointItem* __fastcall TPoints::Add(void)
{
    return (TPointItem*)inherited::Add();
}
//---------------------------------------------------------------------------

조금 도움이 되셨으면하내요..

잘모르시겠으면..

TCoolBar 소스를 열어서 보시면 쉽게 아실수 있습니다.

Collection예제로는 TCollBar가 잴로 좋은거 같군요..

From Zeratul

+ -

관련 글 리스트
23364 컴포넌트 맹글때.. 컴포넌트 리스트를.. 답다비 630 2002/12/25
23386     Re:컴포넌트 맹글때.. 컴포넌트 리스트를.. 제라툴 697 2002/12/26
23400         Re:Re:답변에 감사드리며.. Collection에 대한 질문사항이 또 있어요.. 답다비 673 2002/12/26
23403             Re:Re:Re:답변에 감사드리며.. Collection에 대한 질문사항이 또 있어요.. 제라툴 712 2002/12/26
23408                 Re:Re:Re:Re:에러가 뜹니다.. ㅡ ㅡ; 답다비 656 2002/12/27
23422                     Re:Re:Re:Re:Re: 흑~!흑~! 답글좀 달아주세요..ㅜ.ㅜ 앞에다 정리해서 다시 올릴까?ㅜ.ㅜ(냉무 답다비 607 2002/12/27
23406                 Re:Re:Re:Re:감사합니다(_`_)...질문드린김에 하나 더 여쭤봐도~ ㅡㅡ;;; 답다비 657 2002/12/26
23367     Re:컴포넌트 맹글때.. 컴포넌트 리스트를.. 유영인.Chris 753 2002/12/25
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.