Historical forum-msg-id-134660-edit, Revision 6

Original date:2019-11-07 10:28:54 Edited by: irv Subject: Re: Need A Quick Fix

Icy_Viking said...

Well I was able to get it to delete one item at a time. However I must be doing something a little wrong since I can't get it to delete a selected item, or it crashes.

procedure Remove_Game(integer self, integer event, sequence parm) 
 
	for i = 1 to length(Game_List) do 
		getIndex(Game_List) 
		deleteItem(Game_List,getItem(Game_List,i)) 
	end for 
	 
end procedure 
setHandler(Game_List_Remove,w32HClick,routine_id("Remove_Game")) 

getIndex() returns the index number(s) of the item(s) selected. Save that, and then deleteItem(Game_List,index) You can look at index to see if it is an integer or a sequence of integers.

procedure Remove_Game(integer self, integer event, sequence parm) 
object index = getIndex(Game_List) 
       ? index -- put this here for a peek at what is being returned 
       if atom(index) and index > 0 then -- an item was selected, so... 
           deleteItem(Game_List,index) 
       else -- multiple items were selected, so... 
         for i = 1 to length(index) do -- process each item 
             deleteItem(Game_List,index[i]) 
         end for 
       end if 
end procedure 
setHandler(Game_List_Remove,w32HClick,routine_id("Remove_Game")) 
Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu