Hello,
I have a subclassed grid (with a PyTableBase under it).
In the end, I'd like to be able to select mulitple cells, copy them to the clipboard, and paste them other places.
I can do a single cell pretty easily.
def OnCopySelection(self, event):
buffer = wx.TextDataObject()
currentcol = self.GetGridCursorCol()
currentrow = self.GetGridCursorRow()
print "cells:", self.GetSelectedCells()
print "rows:", self.GetSelectedRows()
data = self.GetCellValue(currentrow, currentcol)
if (wx.TheClipboard.Open()):
buffer.SetText(data)
wx.TheClipboard.SetData(buffer)
wx.TheClipboard.Close()
This said, I have two questions:
1. How do I get access to what cells are selected? I see the cell foreground change color when I select them, but
print "cells:", self.GetSelectedCells()
print "rows:", self.GetSelectedRows()
print self.GetSelectionBlockBottomRight()
print self.GetSelectionBlockTopLeft()
print self.GetSelectionMode()
Return empty lists! (Well, GetSelectionMode() returns 0)
2. What sort of object should the multiple cells be to put into a clipboard object? Do I have to iterate over them? Ideally, I'd like to store it as though it's a table, or clump of cells that would paste like MS Excel (or OO.org Calc) data.
Thanks as always for the help!
Gregg Lind, M.S.
Division of Epidemiology and Community Health
School of Public Health
University of Minnesota
PedSeer Pedigree Analysis Suite -- www.lind-beil.net/pedsheet/