2013-05-23 4 views
0

NSTextFieldCell을 프로토 타입으로 사용하여 NSMatrix를 만들었습니다.NSTextFieldCell 프로토 타입에서 NSFormCell의 메서드를 호출하는 NSMatrix

-[NSTextFieldCell setTitleWidth:]: unrecognized selector sent to instance 0x21191040 

왜 코코아 setTitleWidth를 호출 : NSTextFieldCell 프로토 타입에 뷰가 윈도우에 추가 그려 때, 나는이 오류가? setTitleWidth : NSFormCell 메서드이며 NSTextFieldCell 메서드는 아닙니다.

해당 프로토 타입을 서브 클래스 화하고 setTitleWidth : 및 titleWidth :에 대해 더미 메서드를 추가하면 모든 것이 작동하지만 이는 분명히 해킹입니다.

아이디어가 있습니까?

(defclass easygui::cocoa-matrix-cell (easygui::cocoa-extension-mixin ns:ns-text-field-cell) 
    ((title-width :accessor title-width)) 
    (:metaclass ns:+ns-object)) 

(objc:defmethod (#/setTitleWidth: void) ((self easygui::cocoa-matrix-cell) (width :<CGF>LOAT)) 
    (setf (title-width self) width)) 

(objc:defmethod (#/titleWidth: :<CGF>LOAT) ((self easygui::cocoa-matrix-cell) (size :<NSS>IZE)) 
    (title-width self)) 

(defmethod initialize-instance :after ((view sequence-dialog-item) &key) 
    (let ((cocoa-matrix (cocoa-ref view)) 
     (prototype (#/init (#/alloc easygui::cocoa-matrix-cell)))) 
    (#/setPrototype: cocoa-matrix prototype) 
    (#/setMode: cocoa-matrix #$NSListModeMatrix) 
    (#/setIntercellSpacing: cocoa-matrix (ns:make-ns-size 0 0)) 
    (set-cell-size view (cell-size view)) 
    (set-table-sequence view (table-sequence view)) 
    )) 
+0

당신이에는 EasyGUI 패키지로 휴대 클래스를 정의하기 위해 선택한 이유를 특별한 이유가 있나요 :

여기에 필요한 변화인가? 가능하면 그렇게하지 않을 것입니다. 또한 easygui가 아직 젊음을 기억하고,'- [setTitleWidth :]'에 대한 호출은 easygui에서 하드 코딩 될 수 있습니다. 디자인이 제대로 작동하는지 확인하는 유일한 방법은 빠른 Xcode 프로젝트를 작성하는 것입니다. – tuscland

+0

Xcode를로드해야 할 수도 있습니다. easygui에서는 하드 코딩 된'setTitleWidth :'메소드가 없으며, CCL src에서는 의심 할 여지가 없습니다. –

답변

0

그것은 내 NSMatrix 객체가 실제로 NSForm 객체라고 밝혀졌다 : 다음 작업 코드의 관련 섹션입니다. 후자는 전자를 상속하지만, 프로토 타입으로 NSFormCell을 사용해야한다고 요구합니다. NSForm 개체에 NSTextFieldCell 프로토 타입을 사용하려고했는데, 그 이유는 해당 NSFormCell 메서드가 여전히 호출 중이기 때문입니다.

-(defclass easygui::cocoa-matrix (easygui::cocoa-extension-mixin ns:ns-form) 
+(defclass easygui::cocoa-matrix (easygui::cocoa-extension-mixin ns:ns-matrix) 
관련 문제