From: Alex T. <al...@tw...> - 2005-06-08 17:54:24
|
kim...@ya... wrote: >Okay, Alex, > >The simpleBrowser example works. May be it doesn't >use KeyEvent? > > > It does (at least, the version I have does). It has def on_fldURL_keyPress(self, event): keyCode = event.keyCode target = event.target if keyCode == 13: self.on_goURL_command(None) else: event.skip() which is why I mentioned typing a URL to it. Check if your sample/simpleBroswer has that too .... >I replaced the KeyEvent code in pythoncard\event.py to >the code you listed and the program doesn't crash. >It's not working like one would expect, however (may >be that's your purpose?) When I hit a key, say >BACKSPACE, the lower text field becomes >"TextArea18"... > > Sounds right - it previously had "TextArea1" in it (from the resource definition), so when you hit BACKSPACE it should: print the "point" to the console window and then execute the keyPress handler, which says def on_TextField1_keyPress(self, event): print event.keyCode self.components.TextArea1.text = self.components.TextArea1.text + "%d\n" % (event.keyCode) i.e. add the decimal value of the keyCode to the end of the text of TextArea1; BACKSPACE is ctrl-H == 8, so this is what I'd expect. Note I didn't do an event.Skip() in on_TextField1_keyPress, so the key would not be passed through the usual processing..... so (tentatively) I think the modified code is giving the right result. >Incidentally, my KeyEvent doesn't look like the one >you listed. It's doing: > >## > def decorate(self, aWxEvent, source): > aWxEvent = Event.decorate(self, aWxEvent, source) > > # this is basically the same block as MouseEvent.decorate > # but it seems wrong to have KeyEvent be a subclass of MouseEvent > aWxEvent.position = tuple(aWxEvent.GetPosition()) > aWxEvent.x = aWxEvent.GetX() > aWxEvent.y = aWxEvent.GetY() > aWxEvent.altDown = aWxEvent.AltDown() > aWxEvent.controlDown = aWxEvent.ControlDown() > aWxEvent.shiftDown = aWxEvent.ShiftDown() > > aWxEvent.keyCode = aWxEvent.GetKeyCode() > return aWxEvent >## > > > > I can't see what's different between that and what I quoted in the original mail Could you change lines 335-341 of PythonCard/event.py from class KeyEvent(Event): def decorate(self, aWxEvent, source): aWxEvent = Event.decorate(self, aWxEvent, source) # this is basically the same block as MouseEvent.decorate # but it seems wrong to have KeyEvent be a subclass of MouseEvent aWxEvent.position = tuple(aWxEvent.GetPosition()) (I only listed lines 335 to 341 - so apart from funny indentation of the comment, it looks the same as what you have). Perhaps just the confusion of line-wrapping in email ? >>From the Help function of the resource editor, I get: > >PythonCard > >PythonCard is a GUI construction kit for building >cross-platform desktop applications on Windows, Mac OS >X, and Linux, using the Python language. > >PythonCard version: 0.8.1 >wxPython version: 2.5.4.1 >Python version: 2.3.5 (#62, Feb 8 2005, 16:23:02) >[MSC v.1200 32 bit (Intel)] >Platform: win32 > >I will look around and see if I can find 0.8.2. > > As I said above - it looks as though it's working for you 0.8.1, so unless you run into a problem, you may be able to stick with 0.8.1 (0.8.2 may be only in CVS) >Regarding the unicode version, so far the only problem >I found is in the multi-column control. It was using >"String" as a class type check. The proper check >should have been "Strings". > > We should make sure we get that fix incorporated - but maybe we'll let it sit until you have another week or two's experience, in case you run into anything else .... -- Alex Tweedly http://www.tweedly.net -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.6.2 - Release Date: 04/06/2005 |