Clear questions and runnable code
get the best and fastest answer
Perl Gtk2 AboutDialog's "set_url_hook()" is Not Working as Expected.by mmartin (Monk)
|on Aug 22, 2013 at 17:58 UTC||Need Help??|
mmartin has asked for the
wisdom of the Perl Monks concerning the following question:
So I'm creating the AboutDialog for my GUI and I'm doing the "set_website" portion and trying to make the URL I enter actually do something when you click on it. I read that you do the set_url_hook() part before you run the set_website() method/function.
So I was having trouble just getting Perl to open a Browser and go to a URL, but I figured out how to do that part by using the Perl Module use Browser::Open qw( open_browser ); which seems to work pretty well. I then tried the code below and now, when I open the AboutDialog box, it instantly opens whatever URL I put in the "open_browser()" function from that Module without clicking on the link.
So from what's going on here I would assume that whatever you put inside the "set_url_hook()" function gets executed immediately upon creation of the AboutDialog. I did see a SIGNAL available for the AboutDialog that's called "activate-link" but I couldn't connect it with "signal_connect" function...
Does anyone know what I'm missing here? I would assume there is something that I need to add to this to get it working?
I've also noticed this... So I click the MenuItem to open the AboutDialog, and like I mentioned before, the set_url_hook() gets executed immediately without having to click the link. So I close the page that opened and go back to the About Window and click on the Link itself. When that happens I can see this error below being printed to the terminal.
And the line that the error references to is the line that has Gtk2->main; on it... So I tried putting a test sub in the set_url_hook() and I get the same error and whatever the Sub returns is what Perl is saying is a Undefined Subroutine.
So if my function returns "Hello", the Error would be:
So I just thought I should mention that since I'm tinkering with it a bit...
Thanks in Advance,