On Tuesday 18 August 2009 11:25:35 am Nate Lowrie wrote: > Ed Leafe wrote: > > Since you are moving the bizobj record pointer when you select nodes > > on the tree, it probably would make sense to check for pending changes > > before doing the seek. > > I moved the save into the TreeSelection menu. However, I am still > having a problem. I have the following code that fires on the Tree > Selection bizobj: > > def updateBizobj(self, evt): > if self.taskBizobj.isChanged(): > print "saving bizobj" > self.taskBizobj.save() > > print "moving to PK" > self.taskBizobj.moveToPK(self.taskNodeDic[self.Selection]) > self.Form.update() > > > I make a change to the dEditBox and click directly on another node in > the tree. The event fires and isChanged() is returning false, then we > move to the new PK. Now, if I go click on another node, isChanged > returns true and the bizobj is saved. However, the value in dEditBox > gets attached to the second node and not the first node like it should. > I bound a method to the ValueChanged event on the dEditBox that had a > print statement in it to see if the ValueChanged event was being > recognized and fired before or after the TreeSelection selection event. > It is firing after the TreeSelection event, which leads me to believe > that the code that updates the bizobj is not being fired until that > event is called. If this is the case, I think that this is a bug in the > events system, though I don't know what we can do about it. > > This has not been a show stopper. I simply changed my code above to the > following below and everything worked. However, I still think that this > should be fixed. > > def onNodeChange(self, evt): > dabo.ui.callAfter(self.updateBizobj) > > def updateBizobj(self): > if self.taskBizobj.isChanged(): > print "saving bizobj" > self.taskBizobj.save() > > print "moving to PK" > self.taskBizobj.moveToPK(self.taskNodeDic[self.Selection]) > self.Form.update() > > Regards, > > Nate
Correct me if I'm wrong. You are saying that the tree event is firing before the bizobj realizes that a field was changed. Did you by chance check old.value vs. new.value (not sure what the real code should be) in the onNodeChange method? I would have thought the lostfocus would have fired first. Johnf _______________________________________________ Post Messages to: Dabo-users@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/200908181134.55985.jfabi...@yolo.com