-------------------------------------------------------------------------------- --# GTK Check buttons -------------------------------------------------------------------------------- include GtkEngine.e constant docs = "CheckButtons\nSelect your favorite item(s)", menu = {"_Burgers","_Hotdogs","_Potato chips","_French fries"}, bob = create(GdkPixbuf,"./thumbnails/user_icon.gif") -- logo -- underscores implement 'hot keys' i.e. alt-h gets you a hotdog -- try alt-b,f,e constant win = create(GtkWindow, "size=150x-1,border=10,position=1,$destroy=Quit,title=`Bob's Drive Inn`") set(win,"icon",bob) constant panel = add(win,create(GtkBox,VERTICAL)) constant lbl = create(GtkLabel,{ {"markup",docs}, {"margin bottom",5}}) add(panel,lbl) object items = {} for i = 1 to length(menu) do items &= create(GtkCheckButton,menu[i]) end for add(panel,items) constant box = create(GtkButtonBox), btn1 = create(GtkButton,"gtk-quit","Quit"), btn2 = create(GtkButton,"face-raspberry#Let's _Eat!",_("PlaceOrder")) add(box,{btn1,btn2}) pack(panel,-box) -- neg sign means 'pack at end' show_all(win) main() -------------------------------------------------------------- function PlaceOrder() -------------------------------------------------------------- object menu = {}, item for i = 1 to length(items) do if get(items[i],"active") then --(1) item = get(items[i],"label") item = remove_all('_',item) --(2) menu &= item & '\n'--(3) end if end for Info(win,"Bob's Drive Thru","Your Order",menu,,bob,bob) --(4) return 1 end function -- (1) We check each button to see if it is 'active' - i.e. checked. -- (2) if so, remove the underscore and -- (3) append it to the order list -- (4) see dialogs.html in the documentation folder for params