From: Jussi S. <jus...@pp...> - 2006-10-23 20:19:36
|
I repost my answer because I first sent it using HTML causing it to get garbled in the archives. Sorry! hwphillips wrote: > hwphillips wrote: > >> In pythoncard, I created a window with various widgets. Then I add a >> wx.grid.Grid control using CreateGrid(). The grid appears on the window >> with the rest of the widgets, I can put values in the cells. However, >> the scroll bars do not work. Also, I can not select any cell with the >> mouse. Help please and thanks. >> >> >> ------------------------------------------------------------------------- >> Using Tomcat but need to do more? Need to support web services, security? >> Get stuff done quickly with pre-integrated technology to make your job easier >> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> > > I used the grid in pyCard and everything works ok. I missed the sample > for it at first. Still, the problem above exists, not sure why. > > I don't quite get it when you at first say that 'everything works ok' and then say that 'the problem above exists'. Could you be more specific please: 1. Could your problems be environment/version related? The application in http://personal.inet.fi/cool/operator/BPMDownload.html uses the grid successfully. BPM runs on Windows XP Home SP2 using Python 2.4.3, wxPython 2.6.3 and PythonCard 0.8.2. 2. If you mean that the simpleGrid demo works but your program doesn't, you should compare them to find the differences. There's bound to be something because in this case the environment and versions are the same for simpleGrid and your program. 3. "the scroll bars do not work" In what way? Are they not visible. Are they visible but do not react when you click the arrows or the empty space of the scroll bar. Can you drag the 'thumb'? 4. "I can not select any cell with the mouse" When I click a cell once the rectangle showing the focused cell goes to that cell. When I now click that cell again the text in that cell is selected i.e. is shown with a different background color emphasizing the fact that the next keyboard operation modifies the whole text. If I hit delete, the text is deleted. If I enter new text it replaces the selection. Doesn't your program behave like this? If you mean that you want the cell value to be selected and copied somewhere when you click the cell, you need to do something like this: def on_ansGrid_leftClick(self, event): print 'ansGrid leftClick' r = event.GetRow() c = event.GetCol() print 'r, c', r, c aCM1 = self.fr.test.items[self.fr.currItm].ansCount - 1 last = aCM1 / self.columns if r > last: print 'r>last', r, last elif r == last: last = aCM1 % self.columns if c > last: print 'c>last', c, last else: print 'set text' self.components.ansField.text = self.components.ansGrid.GetCellValue(r, c) self.components.ansField.SetFocus() #event.Skip() Cheers, Jussi -- Jussi Salmela http://personal.inet.fi/cool/operator/ |