wx.grid: Copying Entered Data Across A Selected Range

44 views
Skip to first unread message

edoxtator

unread,
Aug 28, 2012, 5:12:41 PM8/28/12
to wxpytho...@googlegroups.com
All

I'm looking for a solution to a wx.grid problem and I am hoping someone can assist.  The behavior I want from the grid is like this:

1.  User selects a range of at least 2 cells horizontally (say Column C, Rows 3-9)
2.  User keys in data into the first cell in the selection (C3)
3.  User completes edit, and exits cell by pressing Enter, or any of the arrow keys.
4.  Program takes the value entered into the first cell in the selection (C3), and copies that value to the remaining cells in the selection (C4-C9).

I have tried a couple of different methods of solving this problem, but my noobness is showing:
-Binding directly to the select/change events (EVT_GRID_RANGE_SELECT, EVT_GRID_CELL_CHANGE, EVT_GRID_SELECT_CELL, EVT_GRID_EDITOR_CREATED), which had problems holding the selection after the Enter or arrow keys were pressed
-Using the wx.grid.PyCellEditor (which can't tell the selected range in the grid)

Any thoughts?  I can post code, if needed.

Using Python 2.7.2, wxPython 2.8.12.1 on OS X 10.8.1.

Thanks

-Ed

Gadget/Steve

unread,
Aug 29, 2012, 1:15:44 AM8/29/12
to wxpytho...@googlegroups.com
--
To unsubscribe, send email to wxPython-user...@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en
Ed,
I would have thought that you would have needed something along the lines of:
  • In a range select handler store the details of what is selected to self.LastSelectedRange,
  • In all the other select handlers clear self.LastSelectedRange,
  • In whichever event tells you an edit has ended check if self.LastSelectedRange is set and if it is copy your new value to all the cells in the range.

Gadget/Steve

Reply all
Reply to author
Forward
0 new messages