------------------------------------------------------------------------ --# GTK Spin Button for numeric input ------------------------------------------------------------------------ include GtkEngine.e include std/math.e constant docs = `GtkSpinButton for getting numeric input from user. ` constant win = create(GtkWindow,"size=100x100,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 spin = create(GtkSpinButton,0,10,0.01) -- params: min, max, step [default = 0->100 by 1) set(spin,"margin-left=80,margin-right=80") add(panel,spin) constant box = create(GtkButtonBox,"margin_top=20"), btn1 = create(GtkButton,"gtk-quit","Quit"), btn2 = create(GtkButton,"gtk-ok",_("DisplayValue")) add(box,{btn1,btn2}) add(panel,box) show_all(win) --set(win,"interactive debugging",1) main() --------------------------------------------------------------------------- function DisplayValue() --------------------------------------------------------------------------- object increments = get(spin,"increments") object range = get(spin,"range") atom val = get(spin,"value") Info(win,"Spin Button", format("Value is [.2]",val), format("Range: [] to []\n",range) & format("Increments: [.2], [.2]",increments)) return 1 end function