• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSStatusItem Postition Changing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSStatusItem Postition Changing


  • Subject: Re: NSStatusItem Postition Changing
  • From: Peter Maurer <email@hidden>
  • Date: Wed, 29 Jun 2005 15:37:01 +0200

After searching cocoa-dev, I found out that a private method needs to be used to change the position of a statusitem. However, I do not know how to go about this? Could someone tell me the exact steps to take?

First, you'll need the following interface declaration. Please note that this is undocumented, as in unsupported, as in "don't use!"... (Don't blame me if it doesn't work as expected.)


    @interface NSStatusBar (NSStatusBar_Private)

        - (id)_init;
        - (void)_insertStatusItem:(id)fp8 withPriority:(int)fp12;
        - (id)_lockName;
        - (id)_name;
        - (void)_refreshWindows;
        - (void)_removeStatusItem:(id)fp8;
        - (void)_setLengthOfStatusItem:(id)fp8 to:(float)fp12;
        - (void)_setUpdatesDisabled:(BOOL)fp8;
        - (id)_statusItemWithLength:(float)fp8 withPriority:(int)fp12;
        - (BOOL)_updatesDisabled;

    @end

Then, do something like this...

    NSStatusBar *systemStatusBar = [NSStatusBar systemStatusBar];
    NSStatusItem *statusItem = nil;

if ([systemStatusBar respondsToSelector: @selector (_statusItemWithLength:withPriority:)]) {
if (/* should be leftmost NSStatusItem */) {
statusItem = [systemStatusBar _statusItemWithLength: 0 withPriority: 0];
} else if (/* should be rightmost NSStatusItem */) {
statusItem = [systemStatusBar _statusItemWithLength: 0 withPriority: 8001];
} else if (/* should be to the right of Apple's NSMenuExtras */) {
statusItem = [systemStatusBar _statusItemWithLength: 0 withPriority: INT_MAX];
}
}
if (!statusItem) {
statusItem = [systemStatusBar statusItemWithLength: 0]; // normal positioning
}


Since Tiger, I have to restart the SystemUIServer to get the "should be to the right of Apple's NSMenuExtras" case to work. If anyone knows how to do this without restarting the SystemUIServer, I would be very interested in being told about your solutions...

Cheers,

Peter.

__
http://www.petermaurer.de/software
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NSStatusItem Postition Changing (From: Rakka <email@hidden>)

  • Prev by Date: Re: How to get information from the download manager?
  • Next by Date: Re: How to get information from the download manager?
  • Previous by thread: NSStatusItem Postition Changing
  • Next by thread: Re: How to save TableView's highlighted column & sort order?
  • Index(es):
    • Date
    • Thread