added eugtk examples
This commit is contained in:
54
eugtk/examples/test171.ex
Normal file
54
eugtk/examples/test171.ex
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
------------------------------------------------------------------------
|
||||
--# GtkSpinner demo
|
||||
-- Spinner won't actually spin while a euphoria call is processed,
|
||||
-- such as a call to read a large file.
|
||||
-- If that is the case, you must use tasks. See examples/task.ex
|
||||
------------------------------------------------------------------------
|
||||
|
||||
include GtkEngine.e
|
||||
|
||||
constant docs = `<u><b>GtkSpinner</b></u>
|
||||
|
||||
The spinner won't spin while a lengthy
|
||||
Euphoria call is processed, such as reading
|
||||
a large file.
|
||||
|
||||
For that, you must use tasks to keep
|
||||
the spinner going. See ~/demos/examples/task.ex
|
||||
`
|
||||
constant win = create(GtkWindow,"size=100x100,border=10,$destroy=Quit")
|
||||
|
||||
constant panel = create(GtkBox,VERTICAL,10)
|
||||
add(win,panel)
|
||||
|
||||
constant spin = create(GtkSpinner,{
|
||||
{"size request",30,30}, -- make this any size you wish;
|
||||
{"vexpand",TRUE},
|
||||
{"hexpand",TRUE}})
|
||||
add(panel,spin)
|
||||
|
||||
constant lbl = create(GtkLabel)
|
||||
add(panel,lbl)
|
||||
set(lbl,"markup",docs)
|
||||
|
||||
constant box = create(GtkButtonBox),
|
||||
btn1 = create(GtkButton,"gtk-quit","Quit"),
|
||||
btn2 = create(GtkSwitch,_("Toggle"))
|
||||
add(box,{btn1,btn2})
|
||||
pack(panel,-box)
|
||||
|
||||
show_all(win)
|
||||
main()
|
||||
|
||||
--------------------------------------------
|
||||
function Toggle(atom ctl)
|
||||
--------------------------------------------
|
||||
if get(ctl,"active") then
|
||||
set(spin,"start")
|
||||
else
|
||||
set(spin,"stop")
|
||||
end if
|
||||
return 1
|
||||
end function
|
||||
|
||||
Reference in New Issue
Block a user