Professional Web Applications Themes

NSTableView with preselected rows display problem - Mac Programming

I have a simple NSTableView that I fill in with the wellknown methods (numberOfRowsInTableView/objectValueForTableColumn) and that all works fine. I also pre-select some rows in the table using [tableView selectRow:row byExtendingSelection:YES]; The cells in the table are not editable, I'm just interested in (multiple) row-selections. The table displays OK in the NSTabViewItem it's in, apart from the pre-selected rows: they are not hilited until I select another window or tab. At that moment the pre-selected rows are hilited gray. When I reselect my window (or tab) they're hilited OK in blue. Obbviously I'm missing something in the update process of ...

  1. #1

    Default NSTableView with preselected rows display problem

    I have a simple NSTableView that I fill in with the wellknown
    methods (numberOfRowsInTableView/objectValueForTableColumn)
    and that all works fine. I also pre-select some rows in the
    table using [tableView selectRow:row byExtendingSelection:YES];
    The cells in the table are not editable, I'm just interested in
    (multiple) row-selections.

    The table displays OK in the NSTabViewItem it's in, apart from
    the pre-selected rows: they are not hilited until I select another
    window or tab. At that moment the pre-selected rows are hilited gray.
    When I reselect my window (or tab) they're hilited OK in blue.

    Obbviously I'm missing something in the update process of
    NSTableView! How do I set this up so the table shows with the
    pre-selected rows hilited right away, without the user actually
    clicking the tabviewitem the table is in?

    Thanks!

    --
    rick

    rick Guest

  2. #2

    Default Re: NSTableView with preselected rows display problem

    rick wrote: 

    It sounds like you're not telling the tableview that it needs to be
    redisplayed once you've set the selection. Try sending it a
    -setNeedsDisplayInRect: message after you set the selection.

    -jcr
    John Guest

  3. #3

    Default Re: NSTableView with preselected rows display problem

    John C. Randolph wrote:
     
    >
    >
    > It sounds like you're not telling the tableview that it needs to be
    > redisplayed once you've set the selection. Try sending it a
    > -setNeedsDisplayInRect: message after you set the selection.[/ref]

    That is a bit tricky, the table is filled by the methods at the time
    the system is actually displaying it. The table view is in a tab of a
    tabview. My code is called by the system the moment the table is
    actually to be displayed. The system isn't telling me when it is done
    so I can determine when to send it a setNeedsDisplayInRect?

    I have a (bad) solution: when the window containing the tabview is
    opened I artificially select the tab with the table. That forces
    the data to be loaded in the table. Then I select the first tab.
    This ensures that the tab with the table is clicked by the user
    before it is actually displayed. But that's rather clumsy.

    Btw: Sending it a reloadData in advance has no effect, as long as the
    TableView isn't actually on screen it refuses to load data.

    --
    rick

    rick Guest

  4. #4

    Default Re: NSTableView with preselected rows display problem

    In article <3fcc4be7$0$1499$xs4all.nl>,
    rick <nl> wrote:
     

    Ah. Okay, that explains your problem. Could you instead use a
    datasource to supply the data for that table on demand ?


    Simon Guest

Similar Threads

  1. Replies: 3
    Last Post: October 5th, 04:43 AM
  2. Database Display - How can I repete the rows both ways?
    By heartless in forum Coldfusion Database Access
    Replies: 3
    Last Post: January 21st, 01:28 AM
  3. Display 1 data row as multiple datagrid rows
    By Craig Banks in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: February 21st, 09:25 AM
  4. Display SQL rows by certain field?
    By George Remus in forum PHP Development
    Replies: 3
    Last Post: December 1st, 06:48 PM
  5. Replies: 2
    Last Post: July 30th, 06:03 AM

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