Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Deleting A Selected ListBox Item in A Dialog
#1
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     Help - how to add the trigger to the macro
Code:
Copy      Help
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
Code:
Copy      Help
;/
;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


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)