New topic: 

Deleting selected row in ListBox

<http://forums.realsoftware.com/viewtopic.php?t=43924>

         Page 1 of 1
   [ 3 posts ]                 Previous topic | Next topic          Author  
Message        vkozme          Post subject: Deleting selected row in 
ListBoxPosted: Mon May 07, 2012 10:45 pm                         
Joined: Fri Oct 21, 2005 7:51 pm
Posts: 222                Hi, guys,

I am trying to come with a code to delete selected row in a ListBox

The first part of the code that will determine what row is selected is 
something like that

Dim row,column as Integer
row=Me.RowFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - 
Self.Top)


How can I call it when the "Delete" button is pressed?

Thank you in advance.

vkozme   
                             Top                simulanics          Post 
subject: Re: Deleting selected row in ListBoxPosted: Mon May 07, 2012 11:05 pm  
                       
Joined: Sun Aug 12, 2007 10:10 am
Posts: 492
Location: Boiling Springs, SC                How about for the delete action

Listbox.RemoveRow(Listbox.ListIndex)

 get rid the other code...when the row is clicked it's listindex gets set     
_________________
Matthew A. Combatti
Real Studio 2011 r4.3
Visit Real Studio Developer's Spot!
Systems:
Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8 Beta
Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/
Windows Server 2011/CentOS 5.4 /ReactOS/SimOS
~All REAL Compatible~  
                             Top                vkozme          Post subject: 
Re: Deleting selected row in ListBoxPosted: Mon May 07, 2012 11:51 pm           
              
Joined: Fri Oct 21, 2005 7:51 pm
Posts: 222                thank you,

I also found this solution. Put it into KeyDown of the ListBox

if key = chr(8) and me.listIndex > -1 then
  
  me.removeRow me.listIndex
  
end if


Tested, it works.   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 3 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to