Professional Web Applications Themes

Get front window in cocoa - Mac Programming

Hi, Anyone knows how to get the front window in Cocoa ? I manange to get the the keyWindow and the mainWindow but not the frontWindow Eric...

  1. #1

    Default Get front window in cocoa

    Hi,

    Anyone knows how to get the front window in Cocoa ?

    I manange to get the the keyWindow and the mainWindow but not the
    frontWindow

    Eric

    Eric Guest

  2. #2

    Default Re: Get front window in cocoa

    On Fri, 11 Jun 2004, Eric VERGNAUD wrote:
     

    99% of the time, when you want the 'front' window, you want either the key
    window or the main window. If you really don't care about keyness and
    mainness and just want the frontmost window of your app, you can use
    [NSApp orderedWindows] and grab the first one off the array. I assume
    you're using this for your wrapper framework, but I'll caution you (and
    anyone else who's listening) that this is usually not a good idea anyway.
    Michael Guest

  3. #3

    Default Re: Get front window in cocoa

    dans l'article twistedsys.net, Michael Ash à
    com a écrit le 12/06/04 0:38:
     
    >
    > 99% of the time, when you want the 'front' window, you want either the key
    > window or the main window. If you really don't care about keyness and
    > mainness and just want the frontmost window of your app, you can use
    > [NSApp orderedWindows] and grab the first one off the array. I assume
    > you're using this for your wrapper framework, but I'll caution you (and
    > anyone else who's listening) that this is usually not a good idea anyway.[/ref]

    I do care about keyness, and I'm handling it separately. Why is this not a
    good idea ?

    Eric

    Eric Guest

  4. #4

    Default Re: Get front window in cocoa

    On Sat, 12 Jun 2004, Eric VERGNAUD wrote:
     
    >>
    >> 99% of the time, when you want the 'front' window, you want either the key
    >> window or the main window. If you really don't care about keyness and
    >> mainness and just want the frontmost window of your app, you can use
    >> [NSApp orderedWindows] and grab the first one off the array. I assume
    >> you're using this for your wrapper framework, but I'll caution you (and
    >> anyone else who's listening) that this is usually not a good idea anyway.[/ref]
    >
    > I do care about keyness, and I'm handling it separately. Why is this not a
    > good idea ?[/ref]

    I think it's just that normally, when one asks about the "front window",
    they really mean "the window that has the user's focus" (the key window)
    or "the window that contains the front doent" (the main window). The
    front window isn't necessarily anything interesting; it could be an
    invisible overlay window or something created by an APE for all you know
    (I think). You have to filter those out, generally, and by the time you
    do, you're back to either the key window or the main window, so why go
    through all that trouble?
    Michael Guest

  5. #5

    Default Re: Get front window in cocoa

    dans l'article twistedsys.net, Michael Ash à
    com a écrit le 12/06/04 1:28:
     
    >>
    >> I do care about keyness, and I'm handling it separately. Why is this not a
    >> good idea ?[/ref]
    >
    > I think it's just that normally, when one asks about the "front window",
    > they really mean "the window that has the user's focus" (the key window)
    > or "the window that contains the front doent" (the main window). The
    > front window isn't necessarily anything interesting; it could be an
    > invisible overlay window or something created by an APE for all you know
    > (I think). You have to filter those out, generally, and by the time you
    > do, you're back to either the key window or the main window, so why go
    > through all that trouble?[/ref]

    Because I'm experimenting some tool windows in the NSFloatingWindowLevel
    layer which are neither key or main (the doent window behind is both key
    and main) and I want to know which one is frontmost.

    OrderedWindows did the job

    What's an APE ?

    Eric

    Eric Guest

  6. #6

    Default Re: Get front window in cocoa

    On Sat, 12 Jun 2004, Eric VERGNAUD wrote:
     
    >>
    >> I think it's just that normally, when one asks about the "front window",
    >> they really mean "the window that has the user's focus" (the key window)
    >> or "the window that contains the front doent" (the main window). The
    >> front window isn't necessarily anything interesting; it could be an
    >> invisible overlay window or something created by an APE for all you know
    >> (I think). You have to filter those out, generally, and by the time you
    >> do, you're back to either the key window or the main window, so why go
    >> through all that trouble?[/ref]
    >
    > Because I'm experimenting some tool windows in the NSFloatingWindowLevel
    > layer which are neither key or main (the doent window behind is both key
    > and main) and I want to know which one is frontmost.
    >
    > OrderedWindows did the job[/ref]

    Sounds like a fine reason to me. Just keep in mind that it's possible
    there will be windows you don't expect.
     

    Have a look at <http://www.unsanity.com/haxies/ape>. In short, it's a
    standardized mechanism for injecting code into other applications, which
    is handy for a lot of things but can cause lots of trouble if not used
    carefully. This is just the best-known example, but there are lots of ways
    (many of them Apple-provided and -approved) that foreign code can get
    inside your application.
    Michael Guest

Similar Threads

  1. Modeless dialog parent window in Cocoa
    By ZZmiy@adobeforums.com in forum Adobe Acrobat SDK
    Replies: 4
    Last Post: September 16th, 08:30 AM
  2. Cocoa: resizing window
    By Harold in forum Mac Programming
    Replies: 2
    Last Post: February 19th, 02:26 AM
  3. Fixing Tab Order in Cocoa Window
    By ifiaz in forum Mac Programming
    Replies: 2
    Last Post: September 29th, 03:55 PM
  4. multiple doent and window types in cocoa
    By matt neuburg in forum Mac Programming
    Replies: 0
    Last Post: July 21st, 02:35 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