FROM : Ryan Stevens
DATE : Sun Nov 03 17:26:30 2002
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_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
DATE : Sun Nov 03 17:26:30 2002
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_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
| Related mails | Author | Date |
|---|---|---|
| Bertrand Mansion | Nov 3, 02:24 | |
| Ryan Stevens | Nov 3, 17:26 | |
| Bertrand Mansion | Nov 3, 18:11 |






Cocoa mail archive

