How to override jbox_set_rect()?

Jul 5, 2012 at 9:17am

How to override jbox_set_rect()?

I need to override jbox_set_rect() but am not finding how to do this in the SDK documents.

The issue is that my object needs to precalculate several state variables used in the paint routine (and in other mouse and keystroke handling routines) dependent on its size. The obvious place to do these calculations is when the box rect is set.

Obviously I would need to call the default routine from my custom routine, probably at the start.

I may also need to override the jbox_set_rect_for_view() and jbox_set_rect_for_sym() variants. Is one of these a bottle-neck function? In that case I would only need to override the bottleneck guy.

I apologize if there is some SOP for overriding default attribute setters I should know about, but I’ve gone a bit rusty with the attribute API. Not had to use it for about two years.

#39786
Jul 5, 2012 at 9:31am

You can’t override it as far as I know, but if you might be able to do that with the oksize method:

http://cycling74.com/forums/topic.php?id=28390

#140254
Jul 5, 2012 at 11:10am

Thanks. From my initial test it should work. Not an obvious use of semantics, but it should get me through the night.

I do need to rely on the oksize method being called at instantiation time. This is currently happening. I just hope that doesn’t change in some future release.

#140255
Jul 5, 2012 at 2:03pm

Some of our objects do that so it’s likely to stay this way ;-)

#140256

You must be logged in to reply to this topic.