• 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: ToolTip like info item
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ToolTip like info item


  • Subject: Re: ToolTip like info item
  • From: Ryan Stevens <email@hidden>
  • Date: Sun, 3 Nov 2002 08:26:30 -0800

On Saturday, November 2, 2002, at 05:24 PM, Bertrand Mansion wrote:

> Hi again :)
>
> In the rulers example found in AppKit examples, I have noticed that
> NSRulerView displays some kind of tooltip to show units when the
> markers are
> moved.
>
> I would like to have the same kind of items in my view (just a standard
> NSView though). I thought about using tooltips but they don't fit my
> needs
> because of their delay. Indeed, I need this item to be here all the
> time and
> to be dynamically updated, showing the cursor x, y position.
>
> This is a bit like in the Grab app but with a tooltip look and feel
> (shadow
> included). Is such an item available in cocoa or will I have to
> implement
> something approaching ?
>
> If so, what do you think would be the best way to go ?
>
> Thank you for any hints,

I'd make an NSWindow category similar to this....

@implementation NSWindow(TooltipLike)
+ (NSWindow *)tooltipLikeWindowWithContentRect:(NSRect)someRect
{
NSWindow *yourWindow = [[NSWindow alloc] initWithContentRect:someRect
styleMask:NSBorderlessWindowMask backing:NSBackingStoreRetained
defer:YES];

// This seems "proper", may want a diff. level though..
[yourWindow setLevel:NSStatusWindowLevel];

// Mouse events aren't needed, most likely...
[yourWindow setIgnoresMouseEvents:YES];

// Tooltips are more of a toned-down peachy-yellow I think.
// This will be bright, I just know it. ;-)
[yourWindow setBackgroundColor: [NSColor yellowColor] ];

// ?
[yourWindow setAlphaValue:0.8];

return [yourWindow autorelease];
}
@end


NSWindow *test = [NSWindow
tooltipLikeWindowWithContentRect:NSMakeRect(0,0,60,20)];
[test retain];

// myView = NSTexField with the line border for the tooltip-ish look..?

[test setContentView: myView];
[myView setStringValue:@"good?"];
[test orderFront:nil];

Anyway, good luck and I hope that helps! :-)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: ToolTip like info item
      • From: Bertrand Mansion <email@hidden>
References: 
 >ToolTip like info item (From: Bertrand Mansion <email@hidden>)

  • Prev by Date: NSTask problem...
  • Next by Date: Re: ToolTip like info item
  • Previous by thread: ToolTip like info item
  • Next by thread: Re: ToolTip like info item
  • Index(es):
    • Date
    • Thread