\ File: Listbox.f \ Author: Jeff Kelm \ Created: 08-Dec-1998 \ Updated: 31-Dec-1998 \ Generic List box class NEEDS BasicWin.f CR .( Loading Listbox class...) :Class BasicListbox abs 0 LB_ADDSTRING SendMessage: self LB_ERR OVER = SWAP LB_ERRSPACE = OR ABORT" Error adding string to list box" ;M :M InsertString: ( lpszString index) \ insert string in specified position (0 based) >R rel>abs R> LB_INSERTSTRING SendMessage: self LB_ERR OVER = SWAP LB_ERRSPACE = OR ABORT" Error adding string to list box" ;M :M DeleteString: ( index) \ delete string in specified position (0 based) 0 SWAP LB_DELETESTRING SendMessage: self DROP ;M :M Clear: ( -- ) \ clears all strings from list box 0 0 LB_RESETCONTENT SendMessage: self DROP ;M :M Find: ( lpszString -- index) \ search the list for an item beginning \ with the string (case-insensitive) rel>abs -1 LB_FINDSTRING SendMessage: self ;M :M FindExact: ( lpszString -- index) \ find the first item that matches \ the string exactly (case-insensitive) rel>abs -1 LB_FINDSTRINGEXACT SendMessage: self ;M :M GetCount: ( -- n) \ return count of items in list 0 0 LB_GETCOUNT SendMessage: self ;M :M GetString: ( index -- a n) \ return string of specified item HERE rel>abs SWAP LB_GETTEXT SendMessage: self HERE SWAP ;M :M GetCurrent: ( -- index) \ return current selection item 0 0 LB_GETCURSEL SendMessage: self ;M :M SelectString: ( lpszString -- index) \ select item beginning with string rel>abs -1 LB_SELECTSTRING SendMessage: self ;M :M GetState: ( index -- f) \ returns selection state of list item, tf=selected 0 SWAP LB_GETSEL SendMessage: self LB_ERR OVER = ABORT" GetState: error occurred." 0<> ;M ;Class :Class Listbox