Bug in NSTableView tableView:didClickTableCol

Help
2006-10-03
2013-04-25
  • Daniell Freed
    Daniell Freed
    2006-10-03

    I think I may have found a bug in the CamelBones implementation of NSTableView Delegate method tableView:didClickTableColumn:

    The documentation for this method indicates that this method should be receiving both a NSTableView object and a NSTableColumn object.  I have implemented this delegate and method only seems to get the NSTableView object. 

    My Delegate is pretty simple right now:

    sub tableView_didClickTableColumn : Selector(tableView:didClickTableColumn:) IBAction
    {
        my ($self,$sender) = @_;
       
        NSLog ("click in header");

        NSLog ("Sender:");
        NSLog (Dumper ($sender->selectedColumn()));
    }

    $sender is an NSTableView objects:

    2006-10-03 14:23:20.077 Mactrx[5678] click in header
    2006-10-03 14:23:20.077 Mactrx[5678] Sender:
    2006-10-03 14:23:20.078 Mactrx[5678] $VAR1 = bless( {
                     'NATIVE_OBJ' => 49004784
                   }, 'NSTableView' );

    There are not any other objects in @_ other than the 2 I am grabbing. 

    This makes it more difficult to determine the column that was clicked by the user unless allowsColumnSelection has been enabled. 

    Thanks,
    Dan Freed

     
    • Sherm Pendley
      Sherm Pendley
      2006-10-04

      IBAction declares an action method. Really it's just shorthand for "ArgTypes(@) ReturnType(v)", but it also gives a heads-up to the programmer that the method it's attached to will receive GUI actions.

      That's two reasons why you shouldn't use it with this method: First, you want two arguments, not one. And second, this is a delegate method, not the target for GUI actions.

      Declare your method correctly, with two arguments, and it'll be called fine: ArgTypes(@@)

       
    • Daniell Freed
      Daniell Freed
      2006-10-04

      Thats great.  That completely fixed the problem.  Thanks for the help.