Re: [dabo-users] forcing bizobj to recognize ui change & exception

Author: Miguel Lopes

Posted: 2009-07-12 at 10:06:58

On Sun, Jul 12, 2009 at 3:03 PM, Miguel Lopes<mig.e.lopes@gmail.com> wrote:

> On Sun, Jul 12, 2009 at 2:40 PM, Ed Leafe<ed@leafe.com> wrote:

>> On Jul 12, 2009, at 8:33 AM, Miguel Lopes wrote:

>>

>>> Well, not much of an override!

>>>

>>> =A0 =A0def save(self, evt): self.super()

>>

>> =A0 =A0 =A0 =A0That's your problem: you've overridden a framework method=

and changed

>> the interface. Delete that and the error should go away.

>>

>> =A0 =A0 =A0 =A0Also, the use of 'evt' indicates to me that you are using=

save() as

>> an event handler. Don't confuse handlers with regular methods; it's

>> typically better to do something like:

>>

>> def onSave(self, evt):

>> =A0 =A0 =A0 =A0self.save()

>>

>> =A0 =A0 =A0 =A0This way it is clear that onSave() is there to handle the=

event, and

>> it handles it by calling the save() method.

>>

>>

>>

>> -- Ed Leafe

>>

>

> Ok! I clean that up. But still, if I do a change in the current record

> and then navigate to a different page Dabo doesn't recogine the

> existence of changes. I still have the behavior of recognizing changes

> when I go back to the page.

>

> If I issue self.PrimaryBizobj.getChangedRows(includeNewUnchanged=3DTrue)

> has a first call on my onAppModuleNav(self, evt) method I get an empty

> list!

>

> Using self.requery() works but there are some caveats:

> * I would rather not query the database if there's no need for that,

> and here it makes no sense to do it!

> * Chosing "Yes" or "No" in the "Do you wish to save your changes

> dialog" works well. "No" aborts the method, "Yes" saves and moves on.

> * But "Cancel" does not stop the method, navigates away and remains

> active when I came back. It makes sense its active since neither Yes

> nor No was choosen! But it should also abort navigation.

> * I checked the return value of self.requery(). Seems like it's bugged:

> =A0 =A0 =A0 =A0 =A0* "Yes" returns True

> =A0 =A0 =A0 =A0 =A0* "Cancel" returns None

> =A0 =A0 =A0 =A0 =A0* "No" returns True. Should it not return False?

>

> Miguel

>

Correction!

"No" does not abort the method. It discards changes and proceeds with

navigation.

Sorry for the mistake.

Miguel

©2009 Miguel Lopes