added eugtk examples
This commit is contained in:
50
eugtk/examples/test189.ex
Normal file
50
eugtk/examples/test189.ex
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
------------------------------------------------------------------------------------
|
||||
--# Using GtkPrinter.e, print from an open file handle;
|
||||
------------------------------------------------------------------------------------
|
||||
|
||||
include GtkEngine.e
|
||||
include GtkPrinter.e
|
||||
|
||||
integer fn = open(canonical_path(locate_file("resources/license.txt")),"r")
|
||||
|
||||
constant docs = `Demo of how to print from an open file handle.
|
||||
`
|
||||
constant win = create(GtkWindow,{
|
||||
{"border width",10},
|
||||
{"default size",300,100},
|
||||
{"position",GTK_WIN_POS_CENTER},
|
||||
{"connect","destroy","Quit"}})
|
||||
|
||||
constant panel = create(GtkBox,VERTICAL)
|
||||
add(win,panel)
|
||||
|
||||
constant lbl = create(GtkLabel,docs)
|
||||
add(panel,lbl)
|
||||
|
||||
constant
|
||||
btn1 = create(GtkButton,"gtk-quit","Quit"),
|
||||
btn2 = create(GtkButton,"gtk-print","Print"), -- from a function;
|
||||
btn3 = create(GtkButton,"gtk-print",printer:print_file,fn), -- from file handle;
|
||||
btn4 = create(GtkButton,"gtk-print",printer:print_file,locate_file("GtkEngine.e")),
|
||||
box = create(GtkButtonBox)
|
||||
|
||||
set(btn2,"tooltip text","Print using a user function")
|
||||
set(btn3,"tooltip text","Print from file handle attached to button")
|
||||
set(btn4,"tooltip text","Print from file path/name attached to button")
|
||||
|
||||
add(box,{btn1,btn2,btn3,btn4})
|
||||
pack(panel,-box)
|
||||
|
||||
show_all(win)
|
||||
|
||||
main()
|
||||
|
||||
------------------------------------------------------------------------
|
||||
global function Print()
|
||||
------------------------------------------------------------------------
|
||||
printer:use_line_numbers = FALSE
|
||||
printer:PrintFile("Lesser General Public License\n",fn)
|
||||
printer:use_line_numbers = TRUE
|
||||
return 1
|
||||
end function
|
||||
Reference in New Issue
Block a user