From: Kevin A. <al...@se...> - 2004-04-16 14:57:22
|
> From: ralph heimburger > > In my pythoncard app (memmaint.py), > I have a dialog box displayed when they press the "delete" > button. When I click the delete button the code works as > desired. It displays the dialog with OK/CANCEL and then an alert > to notify me that the record has been deleted. > > Apparently this changes the functionality of the form close event > as well. After I press Delete and then press File->Exit or the > Close form (X) button, the delete event is fired again. Hmm, I'm not sure, but you should be using a mouseClick handler instead of mouseDown (i.e. on_DeleteButton_mouseClick). Do you already have a different DeleteButton mouseClick handler? Do you have a on_close event handler that interacts with the DeleteButton or anything else that might be related? The only other thing I can think of is that an extra click is somehow getting through to the background when you click OK on the alertDialog, perhaps an accidental double-click? Does the Message Watcher show multiple mouseClicks for the DeleteButton? > def on_DeleteButton_mouseDown(self, event): > keyfld="["+self.components.SSN.text+"] > "+self.components.LastName.text+","+self.components.FirstName.text > result=dialog.messageDialog(self, 'Delete Member: > '+keyfld,'Delete Member') > if result['accepted']: > whereclause="WHERE LNAME = > '"+self.components.LastName.text+"' AND FNAME > ='"+self.components.FirstName.text+"' AND MI = > '"+self.components.MI.text+"' AND SSNUM ='"+self.components.SSN.text+"'" > Memselect="SELECT * from member "+whereclause > self.Memcursor.execute (Memselect) > rows=int(self.Memcursor.rowcount) > if rows == 1: > #Insert into member_deleted > Memselect="insert INTO members_deleted SELECT * > from member "+whereclause > self.Memcursor.execute (Memselect) > #Delte from member > Memselect="DELETE FROM member "+whereclause > self.Memcursor.execute (Memselect) > self.rowcount -= 1 > self.showSelected() > dialog.alertDialog(self, 'Member DELETED', 'Information') > In general, when reporting bugs, go ahead and list the platform and version info to make it easier to diagnose the bug. You can get that info from the About dialog under the Debug menu by running any sample or tool with the -d (Debug) or any other runtime window command-line option. For example, on my machine I'm running: PythonCard version: 0.8 wxPython version: 2.5.1.5 PyCrust version: 0.9.4 Python version: 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] Platform: win32 Hmm, I suppose we should make this easier to get to by putting it in the codeEditor and resourceEditor. Perhaps we should even have a separate debug info tool that would list other useful info such the users PYTHONPATH, environment variables, and other system info that could provide clues. Another potential 0.8 release item. :) ka |