Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Grids of dynamic objects responding to mouseovers seem to be quite slow in general, for instance:

Grid[Table[
  Mouseover[Framed[" ", Background -> Blue], 
   Framed[" ", Background -> White]], {i, 50}, {j, 50}], 
 Spacings -> {0, 0}]

How can this lagging be avoided?

share|improve this question
    
It seems reasonably fast to me; how much lag are you seeing? –  Mr.Wizard May 28 '12 at 8:05
    
About a second, but If you increase the size of the grid it gets worse fast. –  M.R. May 28 '12 at 8:09
    
Okay, if I make the grid bigger, e.g. 150x150 I see the lag. What is your application for this many Mouseovers? Perhaps there is a faster approach. –  Mr.Wizard May 28 '12 at 8:12
    
What platform as you on? Linux? On a fairly outdated Windows machine I can highlight about 6-8 cells per second. –  Szabolcs May 28 '12 at 8:21
1  
I had similar problems: I wanted the user to be able to click on a grid. Solved the problem by having just one click event and determining the bin from the mouse coordinates manually. –  Ajasja May 28 '12 at 13:17
show 2 more comments

1 Answer 1

I think the problem is not the Mouseover itself, but with the redrawing of the Framed elements.

This, for example, is much faster:

Grid[Table[
  Mouseover[Style[" ", Background -> Blue], 
            Style[" ", Background -> White]], {i, 50}, {j, 50}], Spacings -> 2,
  Frame -> All]
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.