-------------------------------------------------------------------------------- --# Linking button clicks to a user-written function -------------------------------------------------------------------------------- include GtkEngine.e constant docs = `Linking The 'OK' button is linked to a user-written Euphoria function ` constant win = create(GtkWindow,"border=10,position=1,$destroy=Quit") constant panel = create(GtkBox,"orientation=VERTICAL") add(win,panel) -- Different platforms have different icon sets, -- let's try to find one that will work here. -- We can include our own images in the list, -- as a fallback: sequence icon = valid_icon_name({"face-cool","face-monkey","thumbnails/mongoose.png","error"}) constant face = create(GtkImage,icon,128) -- image from the icon theme at 128px wide add(panel,face) constant lbl = create(GtkLabel) set(lbl,"markup",docs) add(panel,lbl) constant btn1 = create(GtkButton,"gtk-quit","Quit"), btn2 = create(GtkButton,"gtk-ok",_("Moo")), -- _() = get local callback; box = pack_end(panel,create(GtkButtonBox)) add(box,{btn1,btn2}) show_all(win) main() --------------- function Moo() --------------- Info(win, -- parent window; "Moo!", -- dialog title; "You are here", -- dialog primary text (auto bold); "Wasn't that easy??" -- dialog secondary text; ,GTK_BUTTONS_CLOSE, -- buttons; "thumbnails/cowbell2.png", -- dialog icon; "thumbnails/cowbell.png") -- titlebar icon; -- See dialogs.html in the documentation folder for details on the -- prebuilt pop-up dialogs. return 1 end function