SIGSEGV when trying to catch windowWillResize

Matt Mead
  • Matt Mead

    Matt Mead - 2005-11-26

    I'm *very* new to CB.  I have a number of apps I'm trying to put a CB interface on, and haven't made a whole lot of progress with the tutorial.

    I'm currently trying to constrain how small my window can become (to prevent buttons overlaying one another) via the windowWillResize:toSize message to the main window's delegate, but I'm getting a seg fault every time I try to resize.  Here's the code I've put in place:

    sub windowWillResize : Selector(windowWillResize:toSize:) ReturnType(c)    {
      my ($self, $window, $newSize) = @_;
      return 1;

    Any ideas?

    Thanks for this cool toolkit and for any help on this!

    • Sherm Pendley

      Sherm Pendley - 2005-11-30

      First off, the easiest way to specify a minimum size is to do it in Interface Builder. Just select the window, and in the inspector panel choose the "Size" pane.

      Having said that, if you want to use -windowWillResize:toSize: (for whatever reason), you need to declare the correct return and argument types, like this:

      sub windowWillResize : Selector(windowWillResize:toSize:)
          ArgTypes(@{NSSize=ff}) ReturnType({NSSize=ff}) {

          my ($self, $window, $newSize) = @_;

          # Incoming structures are passed as objects, in this
          # case an instance of CamelBones::NSSize

          # See Documentation/Reference/Structs for a list of all
          # the available methods in this class

          my $width = $newSize->getWidth();
          my $height = $newSize->getHeight();

          # Do stuff here, possibly modifying $width and $height

          # Toll-free bridging means you can return a hash ref here
          return { 'width' => $width, 'height' => $height };


Log in to post a comment.