eumandy/eugtk/examples/test85.ex
2016-11-25 00:33:18 -07:00

50 lines
1.1 KiB
Elixir

------------------------------------------------------------------------
--# GtkLabel with web link
------------------------------------------------------------------------
include GtkEngine.e
include std/net/dns.e
constant win = create(GtkWindow,"size=200x100,border_width=10,position=1,$destroy=Quit")
constant panel = create(GtkBox,VERTICAL)
add(win,panel)
constant img = create(GtkImage,"thumbnails/mongoose.png")
add(panel,img)
constant lbl = create(GtkLabel,{
{"markup","""Click <a href="http://openeuphoria.org">OpenEu</a>"""},
{"margin bottom",10},
{"connect","activate-link","OpenLink"}})
add(panel,lbl)
constant btn1 = create(GtkButton,"gtk-quit","Quit")
constant btnbox = create(GtkButtonBox)
add(btnbox,{btn1})
pack(panel,-btnbox)
show_all(win)
main()
----------------------------------------------------
global function OpenLink()
----------------------------------------------------
object uri = get(lbl,"current uri")
if not inet_connected()
or atom(host_by_name(uri)) then
Warn(win,"Error","Cannot connect to Web",uri,,"face-crying")
end if
return 1
end function