Re: NSStatusItem position problem

  • This code found in the mailing list:

    @interface NSStatusItem (Hack)
    - (NSRect)hackFrame;
    @end

    @implementation NSStatusItem (Hack)
    - (NSRect)hackFrame
    {
        return [_fWindow frame];
    }
    @end

    With this:
    NSLog(@"Menu coords x: %f, y: %f\n", [myStatusItem hackFrame].origin.x,
    [myStatusItem hackFrame].origin.x);

    prints "x: -30.000 y: -30.000"

    but the menu is not at that coordinates on the screen...

    How can I get the coordinates on the screen of my NSStatusItem?

    Federico
  • Am 26.11.2007 um 20:06 schrieb Federico:
    > NSLog(@"Menu coords x: %f, y: %f\n", [myStatusItem
    > hackFrame].origin.x, [myStatusItem hackFrame].origin.x);

      No idea why you get such weird values, but check for typos. The code
    you posted prints the "x" value twice... maybe you have similar typos
    elsewhere?

    Cheers,
    -- M. Uli Kusterer
    "The Witnesses of TeachText are everywhere..."
    http://www.zathras.de
  • I have similar problems and I checked my code multiple times for
    typos :(
    I found out that it works perfectly with Leopard and has problems
    under 10.4.11 ?!

    Fabian

    On 27.11.2007, at 15:24, Uli Kusterer wrote:

    > Am 26.11.2007 um 20:06 schrieb Federico:
    >> NSLog(@"Menu coords x: %f, y: %f\n", [myStatusItem
    >> hackFrame].origin.x, [myStatusItem hackFrame].origin.x);
    >
    >
    > No idea why you get such weird values, but check for typos. The
    > code you posted prints the "x" value twice... maybe you have
    > similar typos elsewhere?
  • Hey guys,
    can anyone try this code and tell me if there is really a problem
    with 10.4 ?!

    ////////////////////////////////////////////////////////////////////////
    //
    @interface NSStatusItem (Hack)
    - (NSRect)hackFrame;
    @end

    @implementation NSStatusItem (Hack)
    - (NSRect)hackFrame
    {
        return [_fWindow frame];
    }
    @end

    With this:
    NSLog(@"Menu coords x: %f, y: %f\n", [myStatusItem
    hackFrame].origin.x, [myStatusItem hackFrame].origin.y);
    ////////////////////////////////////////////////////////////////////////
    //

    Fabian

    On 05.12.2007, at 17:20, [nexUmoja] Fabian Jäger wrote:

    > I have similar problems and I checked my code multiple times for
    > typos :(
    > I found out that it works perfectly with Leopard and has problems
    > under 10.4.11 ?!
    >
    > Fabian
    >
    >
    > On 27.11.2007, at 15:24, Uli Kusterer wrote:
    >
    >> Am 26.11.2007 um 20:06 schrieb Federico:
    >>> NSLog(@"Menu coords x: %f, y: %f\n", [myStatusItem
    >>> hackFrame].origin.x, [myStatusItem hackFrame].origin.x);
    >>
    >>
    >> No idea why you get such weird values, but check for typos. The
    >> code you posted prints the "x" value twice... maybe you have
    >> similar typos elsewhere?
previous month november 2007 next month
MTWTFSS
      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    
Go to today