|
From: Alex S. <al...@al...> - 2007-08-04 17:42:03
|
Hi there,
I'm having some problems setting up bindings programmatically.
I'm trying to use a table with a (-) button in that removes it's row
when clicked. The other table columns are bound to an
ActiveRecordSetController, and the button column is unbound (is this
right?). I then use setDataCell on the this column.
This is what I've tried:
cell = OSX::NSButtonCell.alloc.init
cell.objc_send(
:bind, "target",
:toObject, self,
:withKeyPath, "current_sale_controller",
:options, {"NSSelectorName" => "remove" }
)
cell.setTitle '-'
@remove_button_column.setDataCell cell
This doesn't give an error, but nothing happens when you click the
button.
I think it could possibly be a problem with OSX::NSSelectorName not
being a recognized constant, which is why I used the string instead.
Am I on the right track here? Any pointers appreciated, I've searched
google (a lot) before asking and I'm out of ideas...
Thanks in Advance,
Alex Speller |
|
From: Eloy D. <elo...@gm...> - 2007-08-05 12:29:09
|
Hey Alex,
I think that what you want to do is to simply set the target of the
NSButton to the ActiveRecordSetController instance and use a selector
like #removeObject(obj) or #removeSelectedObjects() to tell the
controller to remove the object.
This is also how the + & - buttons work in the MailDemo sample.
Hope it helps :)
Cheers,
Eloy
On 8/4/07, Alex Speller <al...@al...> wrote:
> Hi there,
>
> I'm having some problems setting up bindings programmatically.
>
> I'm trying to use a table with a (-) button in that removes it's row when
> clicked. The other table columns are bound to an ActiveRecordSetController,
> and the button column is unbound (is this right?). I then use setDataCell on
> the this column.
>
> This is what I've tried:
>
> cell = OSX::NSButtonCell.alloc.init
> cell.objc_send(
> :bind, "target",
> :toObject, self,
> :withKeyPath, "current_sale_controller",
> :options, {"NSSelectorName" => "remove" }
> )
>
> cell.setTitle '-'
> @remove_button_column.setDataCell cell
>
> This doesn't give an error, but nothing happens when you click the button.
>
> I think it could possibly be a problem with OSX::NSSelectorName not being a
> recognized constant, which is why I used the string instead. Am I on the
> right track here? Any pointers appreciated, I've searched google (a lot)
> before asking and I'm out of ideas...
>
> Thanks in Advance,
> Alex Speller
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Rubycocoa-talk mailing list
> Rub...@li...
> https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk
>
>
|
|
From: Alex S. <al...@al...> - 2007-08-05 13:30:17
|
Hi Eloy,
That worked! I guess I was barking up the wrong tree!
Cheers,
Alex
On 5 Aug 2007, at 13:29, Eloy Duran wrote:
> Hey Alex,
>
> I think that what you want to do is to simply set the target of the
> NSButton to the ActiveRecordSetController instance and use a selector
> like #removeObject(obj) or #removeSelectedObjects() to tell the
> controller to remove the object.
>
> This is also how the + & - buttons work in the MailDemo sample.
>
> Hope it helps :)
>
> Cheers,
> Eloy
>
> On 8/4/07, Alex Speller <al...@al...> wrote:
>> Hi there,
>>
>> I'm having some problems setting up bindings programmatically.
>>
>> I'm trying to use a table with a (-) button in that removes it's
>> row when
>> clicked. The other table columns are bound to an
>> ActiveRecordSetController,
>> and the button column is unbound (is this right?). I then use
>> setDataCell on
>> the this column.
>>
>> This is what I've tried:
>>
>> cell = OSX::NSButtonCell.alloc.init
>> cell.objc_send(
>> :bind, "target",
>> :toObject, self,
>> :withKeyPath, "current_sale_controller",
>> :options, {"NSSelectorName" => "remove" }
>> )
>>
>> cell.setTitle '-'
>> @remove_button_column.setDataCell cell
>>
>> This doesn't give an error, but nothing happens when you click the
>> button.
>>
>> I think it could possibly be a problem with OSX::NSSelectorName
>> not being a
>> recognized constant, which is why I used the string instead. Am I
>> on the
>> right track here? Any pointers appreciated, I've searched google
>> (a lot)
>> before asking and I'm out of ideas...
>>
>> Thanks in Advance,
>> Alex Speller
>> ---------------------------------------------------------------------
>> ----
>> This SF.net email is sponsored by: Splunk Inc.
>> Still grepping through log files to find problems? Stop.
>> Now Search log events and configuration files using AJAX and a
>> browser.
>> Download your FREE copy of Splunk now >> http://get.splunk.com/
>> _______________________________________________
>> Rubycocoa-talk mailing list
>> Rub...@li...
>> https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk
>>
>>
>
> ----------------------------------------------------------------------
> ---
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a
> browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Rubycocoa-talk mailing list
> Rub...@li...
> https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk
|
|
From: Eloy D. <elo...@gm...> - 2007-08-05 13:40:44
|
Nice :)
Cheers,
Eloy
On 8/5/07, Alex Speller <al...@al...> wrote:
> Hi Eloy,
>
> That worked! I guess I was barking up the wrong tree!
>
> Cheers,
> Alex
>
> On 5 Aug 2007, at 13:29, Eloy Duran wrote:
>
> > Hey Alex,
> >
> > I think that what you want to do is to simply set the target of the
> > NSButton to the ActiveRecordSetController instance and use a selector
> > like #removeObject(obj) or #removeSelectedObjects() to tell the
> > controller to remove the object.
> >
> > This is also how the + & - buttons work in the MailDemo sample.
> >
> > Hope it helps :)
> >
> > Cheers,
> > Eloy
> >
> > On 8/4/07, Alex Speller <al...@al...> wrote:
> >> Hi there,
> >>
> >> I'm having some problems setting up bindings programmatically.
> >>
> >> I'm trying to use a table with a (-) button in that removes it's
> >> row when
> >> clicked. The other table columns are bound to an
> >> ActiveRecordSetController,
> >> and the button column is unbound (is this right?). I then use
> >> setDataCell on
> >> the this column.
> >>
> >> This is what I've tried:
> >>
> >> cell = OSX::NSButtonCell.alloc.init
> >> cell.objc_send(
> >> :bind, "target",
> >> :toObject, self,
> >> :withKeyPath, "current_sale_controller",
> >> :options, {"NSSelectorName" => "remove" }
> >> )
> >>
> >> cell.setTitle '-'
> >> @remove_button_column.setDataCell cell
> >>
> >> This doesn't give an error, but nothing happens when you click the
> >> button.
> >>
> >> I think it could possibly be a problem with OSX::NSSelectorName
> >> not being a
> >> recognized constant, which is why I used the string instead. Am I
> >> on the
> >> right track here? Any pointers appreciated, I've searched google
> >> (a lot)
> >> before asking and I'm out of ideas...
> >>
> >> Thanks in Advance,
> >> Alex Speller
> >> ---------------------------------------------------------------------
> >> ----
> >> This SF.net email is sponsored by: Splunk Inc.
> >> Still grepping through log files to find problems? Stop.
> >> Now Search log events and configuration files using AJAX and a
> >> browser.
> >> Download your FREE copy of Splunk now >> http://get.splunk.com/
> >> _______________________________________________
> >> Rubycocoa-talk mailing list
> >> Rub...@li...
> >> https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk
> >>
> >>
> >
> > ----------------------------------------------------------------------
> > ---
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems? Stop.
> > Now Search log events and configuration files using AJAX and a
> > browser.
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > _______________________________________________
> > Rubycocoa-talk mailing list
> > Rub...@li...
> > https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Rubycocoa-talk mailing list
> Rub...@li...
> https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk
>
|