From: Kevin A. <al...@se...> - 2004-04-06 19:15:20
|
I'm not entirely sure what behavior you want. I suspect you just want to call the setFocus() method on the component you want to select. Also, I wouldn't think that you need to use a mouseDown handler, why not just handle the check in the mouseClick? There is no wrapper of the wxPython validation code in the PythonCard framework at this time, but I'm guessing it is possible to just call the wxPython code directly for validation. I haven't used a validator myself, so I don't know for sure. ka On Apr 6, 2004, at 10:34 AM, Schollnick, Benjamin wrote: > Folks, > > I am running into a issue, that I am having difficulty solving. > (This is my first Pythoncard application....) > > I have the "start" button on my application currently wired to > check and validate the information given to the application... > > --snip-- > def on_BTN_start_activity_mouseDown ( self, event): > self.operation = self.components.RAD_Operation.selected > self.servers = self.components.LIST_Servers.selected > self.simulation = self.components.CHECK_Simulation.checked == 1 > self.configfile = self.components.TXT_cfile.text > > if self.configfile == "" or self.servers == "": > bas_wxpython.wxPython_Alert_Dialog ( wxapp = self, > title="Alert!", msg_text="Please specify a configuration file and a > server > to process." ) > # wxPython.wx.EVT_SET_FOCUS (self, > return '' > > if not(self.configfile == "" or self.servers==""): > # print self.operation > # print self.servers > # print self.simulation > # print self.configfile > > cmd_line = sys.argv[0] > > if self.simulation: cmd_line = cmd_line + " -t" > ..... > ..... > ..... > ---snip--- > > But if I return the focus is still on the button for "start > activity", > and if you click on anything, the application will not change the > focus > away from the "start activity" button. So Pythoncard believes you > are clicking on "start activity", and report the error again. > > I was thinking of using the wxPython setfocus, but that appears to > be > fairly complex? > > Any suggestions on fixing this the "right" way, or a simple way? > > Alternatively, anyone have any focus setting samples? > > I did not see any validation code on the pythoncard site, so I > presume > that there is not a "pythoncard" method for validation? (I might of > missed > it.....???) > > -- Benjamin |