TCollection, TCollectionItem 에서 파생시켜 리스트를 만들고
TCollectionItem 에 이벤트 속성을 넣고 개발시에 이벤트를 생성하려고 하면 오류가 난다.
기존 작성된 메소드 연결은 되는데 생성시만 "Cannot create a method for an unnamed
component" 메세지와 함께 오류가 난다.

원인은 TCollection 에서 GetNamePath 를 호출 할 때 부모 클래스 이름이 없기 때문이다.
GetOwner 라는 메소드에서 Owner 객체가 반환 되어야 하는데,
기본적으로 TPersistent 의 메소드에서 nil(NULL) 을 반환한다.

해결 방법은 Owner 를 기억하고 있다가 GetOwner 메소드로 반환시키면 된다.
이를 구현해 놓은 클래스가 있는데 TOwnedCollection 이다.
TCollection 부분을 TOwnedCollection 으로 고치면 잘 동작할 것이다.

참고: http://delphi.newswhat.com/geoxml/forumhistorythread?groupname=borland.public.delphi.vcl.components.writing.general&messageid=40825226@newsgroups.borland.com

+ Recent posts