Outline View Loading Data

  • Hi All,

    I've have an outline View and a custom View(say View A). Depending on
    the outline view row I'm  displaying views (say a1 a2 a3... etc) on the
    custom view.

    I'm performing some operation after the last row of the outline view
    has been loaded.
    As the outline view loads only the rows which are in the visible
    Rectangle, I'm not able to update my views (a1, a2.....) and drawing.

    Please any body let me know how to solve this. Here is the sample
    code....

    - (void)outlineView:(NSOutlineView *)anOutlineView
    willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)aTableColumn
    item:(id)item {
    if([[aTableColumn identifier] isEqualToString:@"viewName"]) {
      id smallView = nil;
      smallView = [allSmallViews objectForKey:[item ID]];
      [self drawSmallView:smallView atIndex:[anOutlineView
    rowForItem:item]];

      if([outlineView rowForItem:item] == [outlineView numberOfRows]-1) {
        //Do some drawing on the View A
      }
    }
    }

    Thanks
    Kishore
  • It sounds like you have the design wrong, since what you ask should not
    be necessary under any circumstances I can think of.

    What is the goal you're trying to achieve here? Describing what it is
    you want to do may help produce a better mechanism for doing it.

    On Nov 6, 2004, at 4:15 AM, Kishore wrote:

    > I've have an outline View and a custom View(say View A). Depending on
    > the outline view row I'm  displaying views (say a1 a2 a3... etc) on
    > the custom view.
    >
    > I'm performing some operation after the last row of the outline view
    > has been loaded.
    > As the outline view loads only the rows which are in the visible
    > Rectangle, I'm not able to update my views (a1, a2.....) and drawing.
    >
    > Please any body let me know how to solve this. Here is the sample
    > code....
    >
    > - (void)outlineView:(NSOutlineView *)anOutlineView
    > willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)aTableColumn
    > item:(id)item {
    > if([[aTableColumn identifier] isEqualToString:@"viewName"]) {
    > id smallView = nil;
    > smallView = [allSmallViews objectForKey:[item ID]];
    > [self drawSmallView:smallView atIndex:[anOutlineView
    > rowForItem:item]];
    >
    > if([outlineView rowForItem:item] == [outlineView numberOfRows]-1) {
    > //Do some drawing on the View A
    > }
    > }
    > }

    --
    Kevin Ballard
    <kevin...>
    http://www.tildesoft.com
    http://kevin.sb.org
  • Hi Kevin,
    I'm working on a simple project management tool like eTask.

    Here I'm displaying a bar on a custom view depending on the data
    present at a row in the Outline View.

    The bars will have links connected to each other. When ever a row is
    added (nothing but a task) I'm preparing a smallView(bar) for the new
    task and I'm displaying that on the Custom View. Here the problem is
    when ever a task is added I've to update the Links already present on
    my View and I've to adjust the smallviews present on the Custom View
    (Task may be added in between).

    I want to update all the Links only once( when all the tasks are
    loaded).

    On 06-Nov-04, at 3:01 PM, Kevin Ballard wrote:

    > It sounds like you have the design wrong, since what you ask should
    > not be necessary under any circumstances I can think of.
    >
    > What is the goal you're trying to achieve here? Describing what it is
    > you want to do may help produce a better mechanism for doing it.
    >
    > On Nov 6, 2004, at 4:15 AM, Kishore wrote:
    >
    >> I've have an outline View and a custom View(say View A). Depending on
    >> the outline view row I'm  displaying views (say a1 a2 a3... etc) on
    >> the custom view.
    >>
    >> I'm performing some operation after the last row of the outline view
    >> has been loaded.
    >> As the outline view loads only the rows which are in the visible
    >> Rectangle, I'm not able to update my views (a1, a2.....) and drawing.
    >>
    >> Please any body let me know how to solve this. Here is the sample
    >> code....
    >>
    >> - (void)outlineView:(NSOutlineView *)anOutlineView
    >> willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)aTableColumn
    >> item:(id)item {
    >> if([[aTableColumn identifier] isEqualToString:@"viewName"]) {
    >> id smallView = nil;
    >> smallView = [allSmallViews objectForKey:[item ID]];
    >> [self drawSmallView:smallView atIndex:[anOutlineView
    >> rowForItem:item]];
    >>
    >> if([outlineView rowForItem:item] == [outlineView numberOfRows]-1) {
    >> //Do some drawing on the View A
    >> }
    >> }
    >> }
    >
    > --
    > Kevin Ballard
    > <kevin...>
    > http://www.tildesoft.com
    > http://kevin.sb.org
  • On 6. Nov 2004, at 12:24 Uhr, Kishore wrote:

    > Here I'm displaying a bar on a custom view depending on the data
    > present at a row in the Outline View.

    Is that some kind of master/detail view? I.e. are you displaying the
    bars in your custom view only for
    the selected row in the outline view or are you displaying bars for all
    rows present in the outline view?
    I assume the latter.

    > The bars will have links connected to each other. When ever a row is
    > added (nothing but a task) I'm preparing a smallView(bar) for the new
    > task and I'm displaying that on the Custom View. Here the problem is
    > when ever a task is added I've to update the Links already present on
    > my View and I've to adjust the smallviews present on the Custom View
    > (Task may be added in between).

    Why couldn't you observe (using KVO or manually) the array in which the
    tasks are stored? Whenever you observe a change
    you add/remove a bar from you custom view and redisplay.

    > I want to update all the Links only once( when all the tasks are
    > loaded).

    If you use observation it really doesn't make any difference - just
    like the outline view
    your custom view would get the right information "lazily", i.e. when
    redrawing...

    HTH,

    Kay