--# Sorting lists; include GtkEngine.e include std/sort.e constant win = create(GtkWindow, "size=300x500,border_width=5,position=1,$destroy=Quit") constant panel = create(GtkBox,VERTICAL) add(win,panel) constant scroller = create(GtkScrolledWindow) pack(panel,scroller,TRUE,TRUE) object list = { "Sam Spade","Jennifer Anniston","arnold Swartzenoggin", "Glenda T. Goodwitch","Mary Contrary","Claire De_Loon", "Thomas A. Train","Barbarosa","Xavier Cluegot","Joe Schmoe","Sue Mi", "Zuzu Pitts","Tad B. Zippo, III","Bill Clinton","wilbur v. filbert", "King George","Jane Mansfield","sarah McFee","Albert King", "George King","lucile ball","Desi A. Arnaz"} object tmp, first, mi, last, extra for i = 1 to length(list) do first = ' ' mi = ' ' last = ' ' extra = ' ' tmp = split(list[i]," ") switch length(tmp) do case 1 then first = proper(tmp[1]) case 2 then first = proper(tmp[1]) last = proper(tmp[2]) case 3 then first = proper(tmp[1]) mi = proper(tmp[2]) last = proper(tmp[3]) case 4 then first = proper(tmp[1]) mi = proper(tmp[2]) last = proper(tmp[3]) extra = tmp[4] end switch list[i] = {first &' '& mi,last &' '& extra} end for constant tstore = create(GtkListStore,{gSTR,gSTR}) set(tstore,"data",list) constant tcol1 = create(GtkColumn,"title=`First, MI`,type=text,text=1,sort_column_id=1"), tcol2 = create(GtkColumn,"title=Last,type=text,text=2,sort_column_id=2") constant tview = create(GtkTreeView,"rules hint=TRUE,font=Serif,headers visible=TRUE") set(tview,{ {"model",tstore}, {"append columns",{tcol1,tcol2}}}) add(scroller,tview) constant btn1 = create(GtkButton,"gtk-quit","Quit") set(btn1,"tooltip text","Click to close") constant btnbox = create(GtkButtonBox,"margin_top=5,margin_bottom=5") pack(panel,-btnbox) add(btnbox,btn1) show_all(win) main()