one NSDocument, multiple windows; no focus change

Ask a Question related to Mac Programming, Design and Development.

  1. #1

    Default one NSDocument, multiple windows; no focus change

    I've poked around a bit on getting multiple windows working under the
    NSDocument architecture, and have chosen the multiple
    NSWindowControllers route.

    unfortunately, that didn't solve my initial problem, which is that i
    can't seem to get the window focus to change. I have a theory as to
    why, but am not certain. here's my setup:

    In my NSDocument subclass, I load and parse a rather large file.
    While this is happening, I would like another window to pop up in
    front. This secondary window would show a progress bar with an
    NSTextView spitting out information as it's parsing. I've managed to
    get text spitting out fine, but my problem is that this subwindow
    doesn't seem to have 'focus' -- i.e., the little red,yellow, and green
    buttons in the upper left aren't on.

    One theory is that the actual code that does the parsing is inside the
    NSDocument subclass, whose main window is not the "loading" window.
    Here's a snippet called from the NSDocument subclass:

    {
    [[self window] orderOut:self];
    [loadingWindow orderFront: self];

    [self reparseEverything];

    [loadingWindow orderOut:self];
    [[self window] orderFront: self];
    }

    during 'reparseEverything', i call a method on loadingWindow which
    spits out text and does a [textView display] to update itself (being
    the subwindow).

    am i right in thinking that because the actual time-consuming process
    happens in code run by my NSDocument subclass, which owns the main
    window, the focus won't change to my desired "currently loading"
    subwindow?

    thanks
    m
    matt Guest

  2. Similar Questions and Discussions

    1. Change focus in a Spry Tabbed panel
      I have a tabbed panel with three tabs. email form client form - default tab information Is there a way to change the default tab to the tab...
    2. Change the focus of a movie clip (s)
      I have 14 seperate movie clips that animate big to small and back in space to give the illustion of depth, but they over lap depending on where each...
    3. Popup; show, take focus, wait for button action, give focus, hide
      Hi. I've got a popup MC for displaying a message or asking a yes/no question that has to do the following on an event: - show and take focus...
    4. How can I access NSDocument?
      I have a window that is up all the time from the main nib when the application is launched. This window will process the data and depending which...
    5. Getting NSDocument to load a file into current window
      Hi!, I am new to Cocoa, and was hopeing someone could help me with a little problem I was having. I am writing a simple hex editor, and would like...
  3. #2

    Default Re: one NSDocument, multiple windows; no focus change

    In <fa39fc69.0309112345.4cdc99f9@posting.google.com > matt wrote:
    > I've poked around a bit on getting multiple windows working under the
    > NSDocument architecture, and have chosen the multiple
    > NSWindowControllers route.
    >
    > unfortunately, that didn't solve my initial problem, which is that i
    > can't seem to get the window focus to change. I have a theory as to
    > why, but am not certain. here's my setup:
    >
    > In my NSDocument subclass, I load and parse a rather large file.
    > While this is happening, I would like another window to pop up in
    > front. This secondary window would show a progress bar with an
    > NSTextView spitting out information as it's parsing. I've managed to
    > get text spitting out fine, but my problem is that this subwindow
    > doesn't seem to have 'focus' -- i.e., the little red,yellow, and green
    > buttons in the upper left aren't on.
    >
    > One theory is that the actual code that does the parsing is inside the
    > NSDocument subclass, whose main window is not the "loading" window.
    > Here's a snippet called from the NSDocument subclass:
    >
    > {
    > [[self window] orderOut:self];
    > [loadingWindow orderFront: self];
    >
    > [self reparseEverything];
    >
    > [loadingWindow orderOut:self];
    > [[self window] orderFront: self];
    >}
    >
    > during 'reparseEverything', i call a method on loadingWindow which
    > spits out text and does a [textView display] to update itself (being
    > the subwindow).
    >
    > am i right in thinking that because the actual time-consuming process
    > happens in code run by my NSDocument subclass, which owns the main
    > window, the focus won't change to my desired "currently loading"
    > subwindow?
    Instead of formulating a big complicated theory about what's happening
    behind the scenes, what about considering the docs on orderFront? The
    docs specificially say that this method doesn't make its window key or
    main, so you can hardly be surprised if your window doesn't become key
    or main. m.

    --
    matt neuburg, phd = [email]matt@tidbits.com[/email], [url]http://www.tidbits.com/matt[/url]
    REALbasic: The Definitive Guide! 2nd edition!
    [url]http://www.amazon.com/exec/obidos/ASIN/0596001770/somethingsbymatt[/url]
    Subscribe to TidBITS. It's free and smart.
    matt neuburg Guest

Posting Permissions

  • You may not post new threads
  • You may 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