\ File: Listbox.f \ Author: Jeff Kelm \ Created: 08-Dec-1998 \ Updated: 21-May-1999 \ Generic List box class Comment: Revision History (most recent first) 19990521 - Cosmetic cleanup 19981231 - Incorporated the new ChildWindow class. 19981208 - Created Comment; 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 \ insert string in specified position (0 based) :M InsertString: ( lpszString index) >R rel>abs R> LB_INSERTSTRING SendMessage: self LB_ERR OVER = SWAP LB_ERRSPACE = OR ABORT" Error inserting string in list box" ;M \ delete string in specified position (0 based) :M DeleteString: ( index) 0 SWAP LB_DELETESTRING SendMessage: self DROP ;M :M Clear: ( -- ) \ clears all strings from list box 0 0 LB_RESETCONTENT SendMessage: self DROP ;M \ search the list for an item beginning \ with the string (case-insensitive) :M Find: ( lpszString -- index) rel>abs -1 LB_FINDSTRING SendMessage: self ;M \ find the first item that matches \ the string exactly (case-insensitive) :M FindExact: ( lpszString -- index) rel>abs -1 LB_FINDSTRINGEXACT SendMessage: self ;M :M GetCount: ( -- n) \ return count of items in list 0 0 LB_GETCOUNT SendMessage: self ;M \ return string of specified item :M GetString: ( index -- a n) 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 \ select item beginning with string :M SelectString: ( lpszString -- index) rel>abs -1 LB_SELECTSTRING SendMessage: self ;M \ returns selection state of list item, tf=selected :M GetState: ( index -- f) 0 SWAP LB_GETSEL SendMessage: self LB_ERR OVER = ABORT" GetState: error occurred." 0<> ;M ;Class \ Listbox allows only one item to be selected at a time :Class Listbox