added eugtk examples
This commit is contained in:
39
eugtk/examples/test29.ex
Normal file
39
eugtk/examples/test29.ex
Normal file
@@ -0,0 +1,39 @@
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
--# GtkCalendar
|
||||
-- Calendar automatically loads to current date unless told otherwise.
|
||||
-- Calendar date i/o formats are same as std/datetime.e formats
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
include GtkEngine.e
|
||||
include std/datetime.e -- requires use of gtk: namespace
|
||||
|
||||
constant win = gtk:create(GtkWindow,
|
||||
"size=300x300,border_width=10,position=1,$destroy=Quit")
|
||||
|
||||
constant pan = gtk:add(win,create(GtkBox,"orientation=VERTICAL"))
|
||||
|
||||
constant cal = gtk:add(pan,create(GtkCalendar,"$day selected double click=ShowDate"))
|
||||
|
||||
constant lbl = gtk:add(pan,create(GtkLabel,"margin_top=10"))
|
||||
|
||||
constant box = gtk:create(GtkButtonBox)
|
||||
gtk:pack(pan,-box)
|
||||
gtk:add(box,
|
||||
{gtk:create(GtkButton,"gtk-quit","Quit"),
|
||||
gtk:create(GtkButton,"gtk-ok","ShowDate")})
|
||||
|
||||
gtk:show_all(win)
|
||||
gtk:main()
|
||||
|
||||
--------------------------
|
||||
global function ShowDate()
|
||||
--------------------------
|
||||
object clicktime = get(cal,"datetime")
|
||||
gtk:set(cal,"mark day",get(cal,"day"))
|
||||
gtk:set(lbl,"markup",
|
||||
datetime:format(clicktime,`
|
||||
____________<b>Date selected:</b> %A, %b %d
|
||||
<b>Time clicked:</b> %l:%M %p`))
|
||||
return 1
|
||||
end function
|
||||
Reference in New Issue
Block a user