Re: Label and url link to webpage.




On May 26, 2008, at 2:07 PM, kobi_tk interia pl wrote:

Hi,
I recently started learning gtk2-perl.
I write now easy app and I stuck in one places.
I think it is silly and easy but I couldn't find solution.
I want to add to label (or another widget) text which will be a html url
to webpage. When user click it url will be open in default browser. I
tried to add a html tags (<a href> tag) to label but it doesn't work.
Is there any easy and fast way to add such url which will be open in web
browser ?

The widget to do this is here:

http://library.gnome.org/devel/gtk/stable/GtkLinkButton.html

http://gtk2-perl.sourceforge.net/doc/pod/Gtk2/LinkButton.html


But that doesn't handle actually opening the URL, that just invokes a global hook function. How you handle the URL depends on your environment.

For a gnome system that will be something like

    Gtk2::LinkButton->set_uri_hook (sub {
            my ($button, $uri) = @_;

            system "gnome-open '$uri' &";
    });


--
Zella, carrying a kite in a long plastic box:  It's like book!
Yvonne, carrying the wooden kite string spool:  It's like a wood!




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]