Re: about help
Re: about help
- Subject: Re: about help
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Mon, 11 Feb 2002 23:12:32 +0100
Acting on suggestions received (thanks very much!) I have made a
Category for NSView:
#import <Carbon/Carbon.h>
#import <Cocoa/Cocoa.h>
@implementation NSView( NSViewHelpGmd )
- (void)helpRequested:(NSEvent *)eventPtr;
{
NSBundle *mainBundle = [ NSBundle mainBundle ] ;
NSDictionary *infoDictionary = [ mainBundle infoDictionary ];
NSString *helpBookName = [ infoDictionary objectForKey:
@"CFBundleHelpBookFolder" ] ;
NSString *toolTipString ;
NSView *vv ;
OSStatus err ;
// find some view with a tool tip
vv = self ;
for(;;)
{
toolTipString = [ vv toolTip ] ;
if ( toolTipString != nil ) break ;
vv = [ vv superview ] ;
if ( vv == nil ) break;
};
if ( toolTipString == nil ) // open book
{
err = AHGotoPage( (CFStringRef)helpBookName, nil, nil );
}
else // search in book
{
err = AHSearch( (CFStringRef)helpBookName,
(CFStringRef)toolTipString );
};
if ( err != 0 )
{
NSLog(@"helpRequested failed for %@", [ self description ]);
}
else
{
//NSLog(@"helpRequested for %@", [ self description ]);
};
}
@end
Hitting the help key gives a ?-cursor, then clicking on any window,
button or whatever opens the help text (searching for the tool tip
string in the help book). So far so good.
But wouldn't it be nice if Apple could add (along with the tool tip
text) a help-url, and make helpRequested: open this url automatically?
Using the tool tip as search string is clearly only the second best
solution.
Gerriet.
_______________________________________________
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.