01-19-2009, 08:24 PM
I saw the discussion at: http://www.quickmacros.com/forum/showthr...p?tid=2557 regarding "Delete List Box Item in Dialog" but the mechanism was selecting the item to be deleted through a edit field. I wanted to select the item in the list box and then just delete it by hitting the delete key.
I accomplished this through a separate function with a delete key trigger with a filter function of the list box:
Function ListBoxDel
Trigger X //FF_ListBoxDel2
Function FF_ListBoxDel2
This seems to work well. Is there any other way that is intrinsic to ListBox?
It's fine if this is the best way, though.
Stuart
I accomplished this through a separate function with a delete key trigger with a filter function of the list box:
Function ListBoxDel
Trigger X //FF_ListBoxDel2
int hDlg = win("Sample Dialog" "#32770")
int hlb = id(6 hDlg);; the listbox id
str SelectedItemFromListBoxToDelete
_i=LB_SelectedItem(hlb)
if(_i>=0) SendMessage hlb LB_DELETESTRING _i 0
Function FF_ListBoxDel2
;/
;Allows starting macro when mouse pointer is on certain control.
function# iid FILTER&f
if(!f.hwnd2) ret
if(!wintest(f.hwnd "CaseLog" "#32770")) ret ;;change window name and class
if(!childtest(f.hwnd2 "" "ListBox" f.hwnd)) ret ;;change control text and class
ret iid
This seems to work well. Is there any other way that is intrinsic to ListBox?
It's fine if this is the best way, though.
Stuart