Forum: wxRuby Wx:Grid Setting Cursor Position

E50d2ac925f5cf8403197c3cddd11d4b?d=identicon&s=25 Norbert Lange (lange_n)
on 2012-05-22 23:29
I'm using the grid widget with an underlying GridTableBase and trying to
implement a "Find" button which would cause the current cursor position
to go to the next matching cell.  I'm wondering if there's an easy way
to do it?  I'm playing with the Grid.select_block_row(),
Grid.set_grid_cursor() and Grid.scroll() methods, but the results are a
bit erratic.

Is there a better way to do this than using Grid.move_cursor_down/right?

Thanks,
Norbert
E50d2ac925f5cf8403197c3cddd11d4b?d=identicon&s=25 Norbert Lange (lange_n)
on 2012-05-24 17:27
Attachment: Setting_Grid_Cursor_Example.rb (1 KB)
It took a bit of time and experimenting, but this seems to work, for
anyone
else who's maybe run into the same issues.  Here's the code I came up
with for scrolling to a grid position given a cell row and column.  I
hope someone finds it useful.

Norbert
E50d2ac925f5cf8403197c3cddd11d4b?d=identicon&s=25 Norbert Lange (lange_n)
on 2013-06-11 19:45
A bit of a tweak in case someone has used this code.  The original
didn't take into account the width and height of the row and column
labels in calculating whether to reposition the grid.

Norbert
This topic is locked and can not be replied to.