eumandy/eugtk/examples/test170.ex

50 lines
1.2 KiB
Elixir
Raw Permalink Normal View History

2016-11-25 00:33:18 -07:00
---------------------------------------------------------------------------------
--# GtkMessageDialog
---------------------------------------------------------------------------------
include GtkEngine.e
constant docs = `<u><b>GTK message dialog</b></u>
You'll not often need to do this,
the EuGtk built-in dialogs are easier and
more complete.
`
constant win = create(GtkWindow,"border=10,position=1,$destroy=Quit")
constant panel = create(GtkBox,"orientation=VERTICAL")
add(win,panel)
constant lbl = create(GtkLabel)
set(lbl,"markup",docs)
add(panel,lbl)
constant
btn1 = create(GtkButton,"gtk-quit","Quit"),
btn2 = create(GtkButton,"gtk-ok","Foo"),
box = create(GtkButtonBox)
pack(panel,-box)
add(box,{btn1,btn2})
show_all(win)
main()
------------------------
global function Foo()
------------------------
atom dlg = create(GtkMessageDialog,{
{"transient for",win},
{"background","yellow"},
{"message-type",GTK_MESSAGE_INFO},
{"add button","gtk-ok",1},
{"add button","gtk-cancel",0},
{"markup","This is a test"},
{"format secondary text","%s","More here..."}})
get(dlg,"run")
set(dlg,"destroy")
return 1
end function