#!/usr/bin/env exu -------------------------------- -- ComboBox.exu -- Demonstrates: -- GTK Combo Box Text -- GTK Combo Box Entry -------------------------------- include GtkEngine.e include GtkRoutines.e include GtkEnums.e include dll.e constant lbl0 = create(GtkLabel) set(lbl0,"markup", "Second box is <i>tearoff</i>\n" & "Drop down, click on the dotted line at top\n" & "and drag it elsewhere on your screen") ----------------------------------------- function ShowResults(atom ctl, atom data) ----------------------------------------- set(lbl0,"markup", sprintf("Combo %d sez: %s\n", {data,get(ctl,"active text")})) return 1 end function constant show_results = call_back(routine_id("ShowResults")) constant win = create(GtkWindow) connect(win,"destroy",quit) set(win,"Border width",10) set(win,"Default size",300,300) set(win,"Position",GTK_WIN_POS_CENTER) constant panel = create(GtkVBox) add(win,panel) constant lbl1 = create(GtkLabel,"GTK Combo Box Text") constant combo1 = create(GtkComboBoxText) set(combo1,"append text","One") set(combo1,"append text","Two") connect(combo1,"changed",show_results,1) constant sep1 = create(GtkHSeparator) constant lbl2 = create(GtkLabel,"GTK Combo Box Entry") constant combo2 = create(GtkComboBoxEntry) set(combo2,"append text","One Potato") set(combo2,"append text","Two Potato") set(combo2,"append text","Three Potato") set(combo2,"add tearoffs",TRUE) connect(combo2,"changed",show_results,2) pack(panel,{lbl1,combo1,sep1,lbl2,combo2}) add(panel,lbl0) show_all(win) main() -------------------------------------------------------------- -- copyright 2008 by Irv Mullins, code released under the LGPL --------------------------------------------------------------