Wx:Grid Setting Cursor Position

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?


It took a bit of time and experimenting, but this seems to work, for
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.


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.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs