I am experimenting a bit with the Objective C Runtime library, trying to get some custom controls running.
The problem with those built on a complex structure of views and subviews is that on a simple declare you usually don’t get all the components drawn. A simple custom TextField only reserves space to type into but shows neither frame nor other subcontrols. That’s why custom controls often mimic their originals by using custom draw routines when their layoutSubviews or drawRect method gets called.
While this is totally fine, chances are high the controls won’t look right once Apple changes the platform GUI design, which happens quite often. I think a better way would be to implement their original draw routines, probably together with a boolean value that gives the user a chance to replace the draw routines with own implementations. This would mean calling their superobject’s drawRect or layoutSubviews routines.
I couldn’t figure out how to call super like in Obj C directly, but it’s easy to build an objc_super structure by hand.
Only problem now is the structure of the objc_msgSendSuper declare. According to Apple it is
[quote]id objc_msgSendSuper ( struct objc_super *super, SEL op, … );
A pointer to an objc_super data structure. Pass values identifying the context the message was sent to, including the instance of the class that is to receive the message and the superclass at which to start searching for the method implementation.
A pointer of type SEL. Pass the selector of the method that will handle the message.
A variable argument list containing the arguments to the method.[/quote]
I have found examples using this method without additional parameters, and an ellipse is no object that could be programmed. Does this comment mean the method exists in two flavors, one without additional parameters and one with a Ptr to a memoryblock(?) that contains the values, NIL- terminated?