Professional Web Applications Themes

[Q] am I allowed to call NSTableDataSource informal protocol methods myself? - Mac Programming

Boy Cocoa is truly fun and I am enjoying learning how to program in it. (I find Objective-C easy and the Objective-C Language manual of Feb 2004 is extremely well written - one of the clearest I've ever read). But enough of that - my current question is this: When I want to access one of the attributes of an NSTableView is it permitted to call one of the informal protocol methods (id)tableView: (NSTableView *)tableView objectValueForTableColumn: (NSTableColumn *)tableColumn row:(int)row from within a MyDoent method? Because at present to get the contents of the cell I now do the following: ...... ...

  1. #1

    Default [Q] am I allowed to call NSTableDataSource informal protocol methods myself?

    Boy Cocoa is truly fun and I am enjoying learning how to program in it.
    (I find Objective-C easy and the Objective-C Language manual of Feb 2004
    is extremely well written - one of the clearest I've ever read).
    But enough of that - my current question is this:

    When I want to access one of the attributes of an NSTableView is it
    permitted to call one of the informal protocol methods
    (id)tableView: (NSTableView *)tableView objectValueForTableColumn:
    (NSTableColumn *)tableColumn row:(int)row
    from within a MyDoent method?

    Because at present to get the contents of the cell I now do the
    following:
    ......
    // Get the text in the MAC Address cell and validate it
    unsigned int row = [tableView selectedRow];
    PasswordRecord *pwrec = [passwordRecords objectAtIndex:row];
    tempDelimitedString =[pwrec macAddress]; // using the accessor
    ,,,,,,,
    and it occurred to me that it would be more elegant to use
    objectValueForTableColumn along the lines of:

    tempDelimitedString = [tableView objectValueForTableColumn:[tableView
    tableColumnWithIdentifier:"macAddress"]:[tableView selectedRow]


    Comments?

    respect...

    Peter
    Peter Guest

  2. #2

    Default Re: [Q] am I allowed to call NSTableDataSource informal protocol methods myself?

    In article
    <bloor.is.net.cable.rogers.com>,
    Peter Teeson <com> wrote:
     

    No reason not to do it, if it makes sense in your code. You implemented
    it, so go ahead and call it.

    --
    Tom "Tom" Harrington
    Macaroni, Automated System Maintenance for Mac OS X.
    Version 2.0: Delocalize, Repair Permissions, lots more.
    See http://www.atomicbird.com/
    Tom Guest

  3. #3

    Default Re: [Q] am I allowed to call NSTableDataSource informal protocol methods myself?

    In article
    <bloor.is.net.cable.rogers.com>,
    Peter Teeson <com> wrote:
     

    Any object can send any message to any other object. Up to you to make
    sure that your implementations are sane in general.

    --
    Standard output is like your butt. Everyone has one. When using a bathroom,
    they all default to going into a toilet. However, a person can redirect his
    "standard output" to somewhere else, if he so chooses. - Jeremy Nixon
    Gregory Guest

  4. #4

    Default Re: [Q] am I allowed to call NSTableDataSource informal protocolmethods myself?

    Peter Teeson wrote: 

    There's no technical reason to avoid it, but your solution strikes me as
    fairly clunky. Why not abstract both into another method?

    - (void)macAddressForIndex:(unsigned)index

    Call that method from your implementation of tableView:
    objectValueForTableColumn: row: and elsewhere as well.

    --
    Pull out a splinter to reply.
    Peter Guest

Similar Threads

  1. Replies: 5
    Last Post: November 29th, 12:27 PM
  2. #40459 [NEW]: Stat and Dir stream wrapper methods do not call constructor
    By clay at killersoft dot com in forum PHP Bugs
    Replies: 1
    Last Post: February 13th, 09:19 AM
  3. Replies: 6
    Last Post: December 15th, 04:17 PM
  4. Server-Side Async Web Methods call fails
    By altialex in forum ASP.NET Web Services
    Replies: 1
    Last Post: May 18th, 01:04 PM
  5. How to call different methods in one PHP file?
    By Bruce W...1 in forum PHP Development
    Replies: 7
    Last Post: October 7th, 10:03 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139