From: John L. <jla...@gm...> - 2006-08-01 04:50:14
|
On 7/30/06, Richard Simes <ric...@gm...> wrote: > I have just started writing a spreadsheet program in lua that supports > functions, cell ranges and sorting. have got to the point where it really > needs a user interface to be useable to anyone so am investigating wxLua. Lua should make scripting arbitrary functions fairly easy. > How can I use a wxGrid in such a way that the value typed into a cell is not > the same as the value displayed? (if a function is inputted) This is probably best done using a lua table in addition to the wxGrid's "cell value" which is just the displayed string value. The lua table could store the values using a string represenation of the coords, eg. string.format("%d, %d", row, col). > I imagine i need to call grid:SetDefaultRenderer() > can a cell renderer object be defined from lua? As it's user-data, I suspect > this might not be possible? SetDefaultRenderer has been broken in wxWidgets for years, I submitted a patch quite some time ago, but I think it's been lost since. You can catch the events for set cell value and put them into a separate lua table and then write to the wxGrid what the output of the function or whatever was entered should be. I think this would be simplest and should be enough. > Help would be appreciated, though I suppose I should read up on wxWidgets a > bit more before I launch into this myself... The wxGrid component is hard to get a handle on at first glance, but hopefully since you don't have to compile as in C++ you can get something going fairly quickly. Regards, John Labenski |