in reply to Re: Perl Gtk2 AboutDialog's "set_url_hook()" is Not Working as Expected.
in thread Perl Gtk2 AboutDialog's "set_url_hook()" is Not Working as Expected.

Ok... Got it working!

So this is what I've found out this morning testing the set_url_hook() function. Seems that whatever is set in "$about_window->set_website($url);" for the $url variable will get passed to the "open_url()" sub which is an argument to the "$about_window->set_url_hook("open_url");" function, which is a subroutine.

So with these 2 commands I can now successfully open the URL in a browser when I click on the link:
### 1st we need to define HOOK before we set the website: # *open_url() is a Subroutine: $about_window->set_url_hook("open_url"); ### Now we call the set_website() function: # *The $website var will be passed as an ARG to open_url(): $about_window->set_website($website); # This receives 2 Args: # ARG[0] --> AboutDialog Widget # ARG[1] --> $website sub open_url() { my ($widget, $url) = @_; print " url == $url\n"; print "Widget == $widget\n\n"; open_browser($url); }
So now it seems everything is working as expected...! Thanks again Crackers, if you hadn't posted your example of the set_url_hook("open_broswer", $url) it probably would have taken me much longer to find that's how the syntax should be for that set_url_hook() Function's Arguments...!


So thanks again for the reply, much appreciated!


Thanks Again,
Matt

  • Comment on Re^2: Perl Gtk2 AboutDialog's "set_url_hook()" is Not Working as Expected.
  • Download Code