Q:
I called HIObjectRegisterSubclass to register my custom subclass
of HIView , and got back paramErr (-50). Why?
A:
Assuming all your other parameters are correct, the problem
may be that the HIView object class is registered a little
too lazily. Ordinarily the class is registered when the first
HIView is instantiated. However, if you try to register a
subclass of HIView before instantiating any HIViews (any
windows or controls), then the HIView class hasn't been
registered yet, and HIObjectRegisterSubclass can't find it
and returns an error.
This problem (r. 3020648) will be fixed in an upcoming software update; with that
fix, HIObjectRegisterSubclass will allow lazily registered
classes to register themselves if it can't find the base
class already registered.
Until then, you can work around
this by creating an instance of some other Apple-defined control, for example a
pushbutton that you can create passing NULL as window parameter since you don't need
a valid window with the new HIToolbox creation scheme. You can then dispose that control. This instantiation
of a known HIView class will ensure that the HIView class itself
will be registered and later calls to HIObjectRegisterSubclass will succeed.
[Nov 12 2002]
|