ComponentBoundsConstrainer not called


#1

Hi

I’m using a ComponentBoundsConstrainer on a window in OSX. This window is set to display natively via

setConstrainer( &myConstrainer );
setUsingNativeTitleBar( true );

Now the ComponentBoundsConstrainer::resizeStart() and ComponentBoundsConstrainer::resizeEnd() are not used nor called.
Is this is a bug or is de default behavior ? The ComponentBoundsConstrainer is used when setUsingNativeTitleBar( false );

Jankoen


#2

I seem to remember that that’s because when the OS is doing the resizing, it doesn’t give any kind of callback that could be used to know when the resize starts or finishes…


#3

a NSWindowDelegate receives a call before resizing:

  • (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize;

and applicable notifications are available:

  • (void)windowDidResize:(NSNotification *)notification;
  • (void)windowWillStartLiveResize:(NSNotification *)notification NS_AVAILABLE_MAC(10_6);
  • (void)windowDidEndLiveResize:(NSNotification *)notification NS_AVAILABLE_MAC(10_6);

in NSView we have:

  • (void)viewWillStartLiveResize;
  • (void)viewDidEndLiveResize;

Maybe these can do the job ?


#4

Good call, thanks - I’ve added that now.


#5

Thanks Jules, confirmed, does the trick.

Jankoen