Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Cocoa, using webview, How to display a link in a status bar when mouse is over?

As title says, I'm using webview to display a site and I need to show the link in a status bar when the mouse is over an hypertext... How can I do this? I'm sure it is something very easy but till now I could not find anything about this... Thanks for any help, Massy

like image 557
Blue Avatar asked Dec 19 '12 20:12

Blue


1 Answers

I got it! I was sooo sure it was sooo easy... Here's what I did for anyone who will have my same problem:

-(void)webView:(WebView *)sender mouseDidMoveOverElement:(NSDictionary *)elementInformation modifierFlags:(unsigned int)modifierFlags
{    
   NSArray* keys = [elementInformation objectForKey:WebElementLinkURLKey];

   //here I pass the link to a label
   if (keys != nil) [statusBarLabel setStringValue:[NSString stringWithFormat:@"%@",keys]];
   else [statusBarLabel setStringValue:@""];

//  NSLog(@"%@",keys);
}

Also don't forget to UIDelegate your webView. Peace, Massy

like image 179
Blue Avatar answered Oct 18 '22 07:10

Blue