NSOutlineView

  • My application uses an NSPopupButton and NSOutlineView. PopupButton shows
    all the table names in the database and the outlineView displays the data in
    the corresponding table selected from the popupButton. It is working fine. I
    also need to display one default table's data in the outlineView when I'm
    opening this window. So in the opening method of the window I called the
    same method used for the PopupButton's selection changed, and it runs that
    method but it doesn't fires the events for the OutlineView. So the
    outlineView shows nothing. How can I fires the events for outlineView in
    this method ?

    Thanks in advance
    Mahaboob
  • Hi, Mahaboob,
    Did you try calling [outlineView reloadData] in ur launch method?
    -Chaitanya

    On 30-Dec-08, at 10:33 AM, Mahaboob wrote:

    > My application uses an NSPopupButton and NSOutlineView. PopupButton
    > shows
    > all the table names in the database and the outlineView displays the
    > data in
    > the corresponding table selected from the popupButton. It is working
    > fine. I
    > also need to display one default table's data in the outlineView
    > when I'm
    > opening this window. So in the opening method of the window I called
    > the
    > same method used for the PopupButton's selection changed, and it
    > runs that
    > method but it doesn't fires the events for the OutlineView. So the
    > outlineView shows nothing. How can I fires the events for
    > outlineView in
    > this method ?
    >
    > Thanks in advance
    > Mahaboob
  • Hi Chaitanya,
    I tried it then it fires the event - (int)outlineView:(NSOutlineView
    *)outlineView numberOfChildrenOfItem:(id)item and it returns 0. But when I'm
    selecting the same table from the popupButton then it returns the actual
    number of children. Why this happens?

    Thanks
    mahaboob


    On 12/30/08 12:44 PM, "chaitanya pandit" <chaitanya...> wrote:

    > Hi, Mahaboob,
    > Did you try calling [outlineView reloadData] in ur launch method?
    > -Chaitanya
    >
    > On 30-Dec-08, at 10:33 AM, Mahaboob wrote:
    >
    >> My application uses an NSPopupButton and NSOutlineView. PopupButton
    >> shows
    >> all the table names in the database and the outlineView displays the
    >> data in
    >> the corresponding table selected from the popupButton. It is working
    >> fine. I
    >> also need to display one default table's data in the outlineView
    >> when I'm
    >> opening this window. So in the opening method of the window I called
    >> the
    >> same method used for the PopupButton's selection changed, and it
    >> runs that
    >> method but it doesn't fires the events for the OutlineView. So the
    >> outlineView shows nothing. How can I fires the events for
    >> outlineView in
    >> this method ?
    >>
    >> Thanks in advance
    >> Mahaboob
    >
  • I put breakpoint there but the OutlineView shows nil.

    On 12/30/08 2:49 PM, "Timothy Larkin" <tsl1...> wrote:

    > I would put a breakpoint there and confirm that OutlineView is not nil
    > when you call reloadData.
    >
    > Sent from my iPhone
    >
    > On Dec 30, 2008, at 3:57 AM, Mahaboob <mahaboob...> wrote:
    >
    >> I'm calling this method from the action method that opens this
    >> window. I
    >> used the code:
    >> - (IBAction) openMediaWindow: (id) sender
    >> {
    >> [cbChooseDatabase selectItemWithTitle:@"Default table"];
    >> [self medialistSelectionChanged];
    >> [OutlineView reloadData];
    >> [MediaWindow makeKeyAndOrderFront:sender];
    >> }
    >>
    >>
    >> On 12/30/08 2:17 PM, "Timothy Larkin" <tsl1...> wrote:
    >>
    >>> Depending on when you call the method, the outlet for the outline
    >>> view
    >>> may be nil. For instance, if you call the function from an init
    >>> method
    >>> for some other object in the nib.
    >>>
    >>> Sent from my iPhone
    >>>
    >>> On Dec 30, 2008, at 12:03 AM, Mahaboob <mahaboob...> wrote:
    >>>
    >>>> My application uses an NSPopupButton and NSOutlineView. PopupButton
    >>>> shows
    >>>> all the table names in the database and the outlineView displays the
    >>>> data in
    >>>> the corresponding table selected from the popupButton. It is working
    >>>> fine. I
    >>>> also need to display one default table's data in the outlineView
    >>>> when I'm
    >>>> opening this window. So in the opening method of the window I called
    >>>> the
    >>>> same method used for the PopupButton's selection changed, and it
    >>>> runs that
    >>>> method but it doesn't fires the events for the OutlineView. So the
    >>>> outlineView shows nothing. How can I fires the events for
    >>>> outlineView in
    >>>> this method ?
    >>>>
    >>>> Thanks in advance
    >>>> Mahaboob
    >>
    >>
  • On 30 Dec 2008, at 8:39 pm, Mahaboob wrote:

    >>> I'm calling this method from the action method that opens this
    >>> window. I
    >>> used the code:
    >>> - (IBAction) openMediaWindow: (id) sender
    >>> {
    >>> [cbChooseDatabase selectItemWithTitle:@"Default table"];
    >>> [self medialistSelectionChanged];
    >>> [OutlineView reloadData];
    >>> [MediaWindow makeKeyAndOrderFront:sender];
    >>> }
    >>

    Not enough code here to get to the bottom of it, but can I take it you
    are aware that windows are loaded lazily? In other words if you have a
    window controller loaded from a nib, then the actual window is not
    instantiated until it is first shown. Therefore you can't make any
    calls to any objects such as views within it until it has been loaded.
    Thus OutlineView will be nil until the window is shown for the first
    time.

    The window controller method - windowDidLoad: is what you need to get
    around that - like -awakeFromNib it can be used to do initialisation
    of the items in the window the first time it's shown. After that,
    provided the window isn't released, you can access its controls as you
    wish.

    By the way you ought to use [NSWindowController showWindow] to make
    the window visible as it may be doing more that just a call to -
    makeKeyAndOrderFront:

    hth,

    Graham
  • When I'm calling [self medialistSelectionChanged]; from - (IBAction)
    openMediaWindow: (id) sender, OutlineView shows 0x0 and when I'm calling the
    same method from -(IBAction) comboSelectionChanged: (id) sender then
    OutlineView shows 0x14c460 in debugger.

    On 12/30/08 3:09 PM, "Mahaboob" <mahaboob...> wrote:

    >
    > I put breakpoint there but the OutlineView shows nil.
    >
    > On 12/30/08 2:49 PM, "Timothy Larkin" <tsl1...> wrote:
    >
    >> I would put a breakpoint there and confirm that OutlineView is not nil
    >> when you call reloadData.
    >>
    >> Sent from my iPhone
    >>
    >> On Dec 30, 2008, at 3:57 AM, Mahaboob <mahaboob...> wrote:
    >>
    >>> I'm calling this method from the action method that opens this
    >>> window. I
    >>> used the code:
    >>> - (IBAction) openMediaWindow: (id) sender
    >>> {
    >>> [cbChooseDatabase selectItemWithTitle:@"Default table"];
    >>> [self medialistSelectionChanged];
    >>> [OutlineView reloadData];
    >>> [MediaWindow makeKeyAndOrderFront:sender];
    >>> }
    >>>
    >>>
    >>> On 12/30/08 2:17 PM, "Timothy Larkin" <tsl1...> wrote:
    >>>
    >>>> Depending on when you call the method, the outlet for the outline
    >>>> view
    >>>> may be nil. For instance, if you call the function from an init
    >>>> method
    >>>> for some other object in the nib.
    >>>>
    >>>> Sent from my iPhone
    >>>>
    >>>> On Dec 30, 2008, at 12:03 AM, Mahaboob <mahaboob...> wrote:
    >>>>
    >>>>> My application uses an NSPopupButton and NSOutlineView. PopupButton
    >>>>> shows
    >>>>> all the table names in the database and the outlineView displays the
    >>>>> data in
    >>>>> the corresponding table selected from the popupButton. It is working
    >>>>> fine. I
    >>>>> also need to display one default table's data in the outlineView
    >>>>> when I'm
    >>>>> opening this window. So in the opening method of the window I called
    >>>>> the
    >>>>> same method used for the PopupButton's selection changed, and it
    >>>>> runs that
    >>>>> method but it doesn't fires the events for the OutlineView. So the
    >>>>> outlineView shows nothing. How can I fires the events for
    >>>>> outlineView in
    >>>>> this method ?
    >>>>>
    >>>>> Thanks in advance
    >>>>> Mahaboob
    >>>
    >>>
  • I used awakeFromNib method. When I¹m running the program in debugger,
    outlineView get instantiated and shows its value ³0x14c260² and also its
    variables(_numberOfRows ,...) shows the value ³0² and opens the main window.
    > From the main window when I¹m clicking the button, that opens the window
    containing outlineView, then outlineView shows its value as ³0x99d6938b² and
    also its variables shows nothing, thus opens the window without outline
    data. Then I selected a table from the popup button (which calls the method
    for loading outline data) then outlineView shows its value ³0x14c260² and
    displays outline data.

    On 12/30/08 6:33 PM, "Timothy Larkin" <tsl1...> wrote:

    > I am assuming that the objects in question are loaded from a nib. In that
    > case, you cannot assume that all the nib objects have been created until the
    > nib loader send those objects an awakeFromNib message. Try writing an awake
    > from nib method for one of the nib classes. If you then put a breakpoint, I
    > think you will find that the outline view has been instantiated, and from
    > there you can call your method that loads the outline data.
    >
    >
    >
    >
    > --
    >
    >
    > Timothy Larkin
    >
    >
    > Abstract Tools
    >
    >
    > Caroline, NY
    >
    >
    >
    >
  • I¹m calling this method from a toolbar menu item. I observed that when I¹m
    calling this method from an NSButton¹s action method, outlineView displays
    the outline data.
    Why this happens?
    I need to call this method from toolbar menu item only.
    How can I achieve this?

    On 12/31/08 10:23 AM, "Mahaboob" <mahaboob...> wrote:

    > I used awakeFromNib method. When I¹m running the program in debugger,
    > outlineView get instantiated and shows its value ³0x14c260² and also its
    > variables(_numberOfRows ,...) shows the value ³0² and opens the main window.
    > From the main window when I¹m clicking the button, that opens the window
    > containing outlineView, then outlineView shows its value as ³0x99d6938b² and
    > also its variables shows nothing, thus opens the window without outline data.
    > Then I selected a table from the popup button (which calls the method for
    > loading outline data) then outlineView shows its value ³0x14c260² and displays
    > outline data.
    >
    >
    > On 12/30/08 6:33 PM, "Timothy Larkin" <tsl1...> wrote:
    >
    >> I am assuming that the objects in question are loaded from a nib. In that
    >> case, you cannot assume that all the nib objects have been created until the
    >> nib loader send those objects an awakeFromNib message. Try writing an awake
    >> from nib method for one of the nib classes. If you then put a breakpoint, I
    >> think you will find that the outline view has been instantiated, and from
    >> there you can call your method that loads the outline data.
    >>
    >>
    >>
    >>
    >> --
    >>
    >>
    >> Timothy Larkin
    >>
    >>
    >> Abstract Tools
    >>
    >>
    >> Caroline, NY
    >>
    >>
    >>
    >>
    >
  • Data is stored in a database and I¹m retrieving it by using QuickLite
    database.

    On 12/31/08 6:31 PM, "Timothy Larkin" <tsl1...> wrote:

    > Where are the data coming from? A core data store? Or do you load them
    > explicitly?
    >
    >
    > --
    >
    >
    > Timothy Larkin
    >
    >
    > Abstract Tools
    >
    >
    > Caroline, NY
    >
    >
    >
    > On Dec 30, 2008, at 11:53 PM, Mahaboob wrote:
    >
    >> I used awakeFromNib method. When I¹m running the program in debugger,
    >> outlineView get instantiated and shows its value ³0x14c260² and also its
    >> variables(_numberOfRows ,...) shows the value ³0² and opens the main window.
    >> From the main window when I¹m clicking the button, that opens the window
    >> containing outlineView, then outlineView shows its value as ³0x99d6938b² and
    >> also its variables shows nothing, thus opens the window without outline data.
    >> Then I selected a table from the popup button (which calls the method for
    >> loading outline data) then outlineView shows its value ³0x14c260² and
    >> displays outline data.
    >>
    >>
    >> On 12/30/08 6:33 PM, "Timothy Larkin" <tsl1...> wrote:
    >>
    >>
    >>> I am assuming that the objects in question are loaded from a nib. In that
    >>> case, you cannot assume that all the nib objects have been created until the
    >>> nib loader send those objects an awakeFromNib message. Try writing an awake
    >>> from nib method for one of the nib classes. If you then put a breakpoint, I
    >>> think you will find that the outline view has been instantiated, and from
    >>> there you can call your method that loads the outline data.
    >>>
    >>>
    >>>
    >>>
    >>> --
    >>>
    >>>
    >>> Timothy Larkin
    >>>
    >>>
    >>> Abstract Tools
    >>>
    >>>
    >>> Caroline, NY
    >>>
    >>>
    >>>
    >>>
    >>>
    >>
    >>
    >>
    >
    >
  • When I¹m calling this method from toolbar in the main window,
    first the outlineView shows the value ³0x0² then it call another method,
    that queries the database retrieves all the data needed, and then control
    goes to [OutlineView reloadData]; .then also outlineView shows the value
    ³0x0². Then it fires the event numberOfChildrenOfItem and it returns 0. Thus
    opens the window without any outline data.

    When I¹m calling this method from a button in main window,
    OutlineView shows the value ³0x34890c24² then queries the database and opens
    the window containing outline data.

    On 1/1/09 11:18 AM, "Timothy Larkin" <tsl1...> wrote:

    > Perhaps the data have not yet been loaded when you try to populate the table
    > the first time.
    >
    >
    > --
    >
    >
    > Timothy Larkin
    >
    >
    > Abstract Tools
    >
    >
    > Caroline, NY
    >
    >
    >
    > On Dec 31, 2008, at 10:53 PM, Mahaboob wrote:
    >
    >>
    >> Data is stored in a database and I¹m retrieving it by using QuickLite
    >> database.
    >>
    >> On 12/31/08 6:31 PM, "Timothy Larkin" <tsl1...> wrote:
    >>
    >>
    >>> Where are the data coming from? A core data store? Or do you load them
    >>> explicitly?
    >
    >
  • I was created toolbar items by coding. Now I deleted it and created it by
    using IB. Then all are working well.

    Thanks a lot.
    mahaboob

    On 1/1/09 7:30 PM, "Timothy Larkin" <tsl1...> wrote:

    > I don't understand what you mean by "calling this method from toolbar". How
    > does control go to the toolbar?
    >
    >
    > --
    >
    >
    > Timothy Larkin
    >
    >
    > Abstract Tools
    >
    >
    > Caroline, NY
    >
    >
    >
    > On Jan 1, 2009, at 2:05 AM, Mahaboob wrote:
    >
    >>
    >> When I¹m calling this method from toolbar in the main window,
    >> first the outlineView shows the value ³0x0² then it call another method,
    >> that queries the database retrieves all the data needed, and then control
    >> goes to [OutlineView reloadData]; .then also outlineView shows the value
    >> ³0x0². Then it fires the event numberOfChildrenOfItem and it returns 0. Thus
    >> opens the window without any outline data.
    >>
    >> When I¹m calling this method from a button in main window,
    >> OutlineView shows the value ³0x34890c24² then queries the database and opens
    >> the window containing outline data.
    >