Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Perl Gtk2 AboutDialog's "set_url_hook()" is Not Working as Expected.

by mmartin (Monk)
on Aug 23, 2013 at 14:40 UTC ( [id://1050679]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1050679]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-20 00:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found