New topic: 

Listbox highlight by mouse over

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

         Page 1 of 1
   [ 8 posts ]                 Previous topic | Next topic          Author  
Message        tfindlay          Post subject: Listbox highlight by mouse 
overPosted: Sat Sep 08, 2012 9:19 pm                         
Joined: Mon Oct 10, 2005 12:30 pm
Posts: 140
Location: Keremeos, BC Canada                Is there a way to have listbox 
rows highlight when a dragItem hovers over them?      
_________________
http://www.ttpsoftware.com  
                             Top                DaveS          Post subject: 
Re: Listbox highlight by mouse overPosted: Sat Sep 08, 2012 10:55 pm            
                     
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4115
Location: San Diego, CA                Use DRAGOVER event....  convert the 
Mouse X and Y to Row/Column, then repaint that cell.

There is sample code in the LangRef on how to do that conversion (look for 
SYSTEM.MOUSEX)      
_________________
Dave Sisemore
MacPro, OSX Lion 10.7.4 RB2012r1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top                tfindlay          Post subject: 
Re: Listbox highlight by mouse overPosted: Sun Sep 09, 2012 9:45 am             
            
Joined: Mon Oct 10, 2005 12:30 pm
Posts: 140
Location: Keremeos, BC Canada                Great, thanks!      
_________________
http://www.ttpsoftware.com  
                             Top                tfindlay          Post subject: 
Re: Listbox highlight by mouse overPosted: Sun Sep 09, 2012 10:17 am            
             
Joined: Mon Oct 10, 2005 12:30 pm
Posts: 140
Location: Keremeos, BC Canada                I can't seem to get it to work. In 
the listbox.open event I have Quote:me.AcceptRawDataDrop("text")
In the dragover event I have Quote:  dragRowNum = me.RowFromXY(x,y)
  dragOn = true
In CellBackgroundPaint I have Quote:  if dragOn = true then
  row = dragRowNum
  g.ForeColor = RGB(0,255,0)
  g.fillrect(0,0,g.Width,g.Height)
  end if
Nothing happens when the dragItem is hovering over the listbox.      
_________________
http://www.ttpsoftware.com  
                             Top                DaveS          Post subject: 
Re: Listbox highlight by mouse overPosted: Sun Sep 09, 2012 10:26 am            
                     
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4115
Location: San Diego, CA                you are doing nothing that is forcing 
the listbox to redraw.

in your dragover event do something like..


if dragrownum<>last_dragrow_num then
  last_dragrow_num=dragrownum
  listbox1.invalidate(last_dragrow,-1) ' check the syntax for this (off the top 
of my head)
end if



Note also.. you have nothing to RESET your color. the color of each box will 
change as the cursor goes over it.. but will not change back, unless you 
invalidate those rows again.      
_________________
Dave Sisemore
MacPro, OSX Lion 10.7.4 RB2012r1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top                tfindlay          Post subject: 
Re: Listbox highlight by mouse overPosted: Sun Sep 09, 2012 10:49 am            
             
Joined: Mon Oct 10, 2005 12:30 pm
Posts: 140
Location: Keremeos, BC Canada                After checking the LR I added this 
to the DragOver event Quote:  if dragrownum<>last_dragrow_num then
  last_dragrow_num=dragrownum
  listbox1.invalidate
  end if
It made no difference.      
_________________
http://www.ttpsoftware.com  
                             Top                Lazze          Post subject: 
Re: Listbox highlight by mouse overPosted: Sun Sep 09, 2012 11:20 am            
             
Joined: Thu Jul 27, 2006 7:32 am
Posts: 102
Location: Esbjerg, Denmark                Try using the "MouseOver" event and 
Listbox.RowFromXY

Something like this in "MouseOver"

row=me.RowFromXY(x,y)
HighLight(row)

Where "HighLight" is a method you have to code, which highlights the row "row" 
in your listbox      
_________________
Why make it simple if it can be made complicated? 
http://www.laniesoftware.com  
                             Top                DaveS          Post subject: 
Re: Listbox highlight by mouse overPosted: Sun Sep 09, 2012 11:54 am            
                     
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4115
Location: San Diego, CA                MouseOver is not what he wants..... as 
it fires regardless of the fact there is an object/text being dragged.

I suggest that breakpoints be inserted (and or beeps) to insure that the events 
are evening happening...

As in are you SURE you actually have TEXT in a DRAGITEM?



plus you neglected your DRAGON flag.... it that is still in your PAINT event.. 
the event is firing... but fails the test.      
_________________
Dave Sisemore
MacPro, OSX Lion 10.7.4 RB2012r1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 8 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

rbforumnotifier@monkeybreadsoftware.de

Reply via email to