Skip navigation.
 
mlRe: Position of NSStatusItem
FROM : Joachim Deelen
DATE : Tue Nov 20 23:34:05 2007

As far as I can see the only difference between your and my code is 
that I'm using a fixed length of the StatusItem instead of the 
NSVariableStatusItemLength.

--
Joachim

Am 20.11.2007 um 23:03 schrieb [nexUmoja] Fabian Jäger:

> Now I use this code:
>
> // instantiate statusbar-icon
>         NSStatusBar *systemBar = [NSStatusBar systemStatusBar];
>               theItem = [systemBar statusItemWithLength: 
> NSVariableStatusItemLength];
>         [theItem retain];
>         
>         NSView *tmpView = [[NSView alloc] initWithFrame:NSMakeRect(0.0, 
> 0.0, [theItem length], [[theItem statusBar] thickness])];
>         [theItem setView:tmpView];
>         
>         NSRect globalOrigin = [[[theItem view] window] frame];
>         NSLog(@"%f/%f", globalOrigin.origin.x, globalOrigin.origin.y);
>         
>         [theItem setView:nil];
>         [tmpView release];
>
> The output is: "0.000000/0.000000" ... don't really know what's 
> wrong with the code :-(
>
> Fabian
> nexUmoja.org
>
>
> On 20.11.2007, at 22:57, Joachim Deelen wrote:
>

>> Hi Fabian,
>>
>> since this is an international, english list, I think we should 
>> write english here. Even though my mother tongue is german too...
>>
>> You can't create a View for the StatusItem with that size: The max 
>> height of the MenuBar is 22px. So I thing creating a view with a 
>> height of 50 will fail.
>>
>> It's better to use the following:
>>
>> [[NSView alloc] initWithFrame:NSMakeRect(0.0, 0.0, [statusBarItem 
>> length], [[statusBarItem statusBar] thickness])]
>>
>> This takes the actual length of created StatusItem and the 
>> thickness of the MenuBar into account.
>>
>> Hope this helps
>>
>> Joachim

Related mailsAuthorDate
mlPosition of NSStatusItem [nexUmoja] Fabian… Nov 19, 23:14
mlRe: Position of NSStatusItem Joachim Deelen Nov 20, 22:11
mlRe: Position of NSStatusItem Joachim Deelen Nov 20, 22:57
mlRe: Position of NSStatusItem [nexUmoja] Fabian… Nov 20, 23:03
mlRe: Position of NSStatusItem Joachim Deelen Nov 20, 23:34
mlRe: Position of NSStatusItem [nexUmoja] Fabian… Nov 20, 23:59
mlRe: Position of NSStatusItem Peter Maurer Nov 22, 09:09
mlRe: Position of NSStatusItem [nexUmoja] Fabian… Nov 22, 11:37
mlRe: Position of NSStatusItem Joachim Deelen Nov 23, 23:26
mlRe: Position of NSStatusItem [nexUmoja] Fabian… Nov 24, 03:18