44 lines
1.2 KiB
Elixir
44 lines
1.2 KiB
Elixir
|
|
----------------------------------------------------------------
|
|
--# GtkFileChooserWidget
|
|
----------------------------------------------------------------
|
|
|
|
include GtkEngine.e
|
|
|
|
constant docs = `<b><u>File Chooser Widget</u></b>
|
|
can be added to a window, rather than using a file-open Dialog,
|
|
although it's probably not often a good idea.
|
|
`
|
|
constant win = create(GtkWindow,
|
|
"size=500x400,border_width=10,background=lightyellow,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 fcw = create(GtkFileChooserWidget)
|
|
pack(panel,fcw,TRUE,TRUE,10)
|
|
|
|
constant btn1 = create(GtkButton,"gtk-quit","Quit")
|
|
constant btn2 = create(GtkButton,"gtk-ok",_("Foo"),fcw)
|
|
constant btnbox = create(GtkButtonBox)
|
|
add(btnbox,{btn1,btn2})
|
|
pack(panel,-btnbox)
|
|
|
|
show_all(win)
|
|
main()
|
|
|
|
------------------------------------------------------------------------
|
|
function Foo(atom ctl, object chooser)
|
|
------------------------------------------------------------------------
|
|
object fname = get(chooser,"filename")
|
|
if not atom(fname) then
|
|
Info(win,"File Chooser Widget","Do something with:",fname)
|
|
end if
|
|
return 1
|
|
end function
|
|
|