The examples in the book show the grid taking up all available room in the
frame or panel. None show a button or other widget that initiates a "save"
action under user control. Is there a standard approach to this? That is,
should I decrease the height of the grid, put it and a button in a box
sizer? Or, should the Save be a menu option?
In our application, data will be entered in cells and stored in a database
table. Having a module-specific OnSave() function seems to me to be the best
approach, so a button would be the appropriate widget. No?
Also, since the save function calls INSERT or REPLACE for each grid row to
write it to the database table, I need to determine the first row containing
all empty cells. My initial thought is to walk the grid from the top row
down (in the left-most column) invoking IsCellEmpty(row,col) for each row. Is there an better way to do this?
Rich
···
--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc. | Accelerator(TM)
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863
the grid *table* is not the grid *widget*. self is what you want to
add to the sizer, not self.tableBase.
···
On 8/30/07, Rich Shepard <rshepard@appl-ecosys.com> wrote:
On Wed, 29 Aug 2007, Robin Dunn wrote:
>> Should I decrease the height of the grid, put it and a button in a box
>> sizer?
>
> Either way works.
I changed my mind and decided to use a button for consitency with the
other tabs. However, I'm getting an error that the grid table is not a
window so it cannot be added to a sizer.
Here's the python error message:
File "/data1/eikos/dataPage.py", line 153, in __init__
widgetBox.Add(self.tableBase, 0, wx.ALL, 0)
File "/usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/_core.py",
line 11945, in Add
return _core_.Sizer_Add(*args, **kwargs)
TypeError: wx.Window, wx.Sizer, wx.Size, or (w,h) expected for item
In the class modData I've initiated the grid thusly:
Sigh. How embarrassing! I did not notice the typo because I assumed it was
something to do with the grid or table.
Now, other than the button not displaying, the application displays ...
but the size command is not working. That's for another thread.
Thanks,
Rich
···
On Thu, 30 Aug 2007, Chris Mellon wrote:
Python is case sensitive - note that below you use SaveButton.
--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc. | Accelerators(TM)
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863