WizardPage - BizObj Examples

View: New views
7 Messages — Rating Filter:   Alert me  

WizardPage - BizObj Examples

by Dave Rowe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

Does anyone have an example of tying a BizObj to a WizardPage?  I can't
seem to figure out how it should work.  Maybe I'm going down the wrong
path...

Basically, upon the initial run of the app, I want to have the user fill
out a form, and save to the DB.  This would be used as a parent-type table
for managing multiple instances of the application in a shared DB.

Thanks in advance,
Dave



_______________________________________________
Post Messages to: Dabo-users@...
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/81fd7ebc8d374c48e0869bfbfb18333e@localhost

Re: WizardPage - BizObj Examples

by Ed Leafe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sep 30, 2008, at 6:10 PM, Dave Rowe wrote:

> Does anyone have an example of tying a BizObj to a WizardPage?  I  
> can't
> seem to figure out how it should work.  Maybe I'm going down the wrong
> path...


        Have you added the bizobj to the wizard form? What have you tried so  
far?

-- Ed Leafe





_______________________________________________
Post Messages to: Dabo-users@...
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/3863006E-76FD-4AAD-B72F-588A7A59D51C@...

Re: WizardPage - BizObj Examples

by Dave Rowe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Tue, 30 Sep 2008 18:19:33 -0500, Ed Leafe <ed@...> wrote:

> On Sep 30, 2008, at 6:10 PM, Dave Rowe wrote:
>
>> Does anyone have an example of tying a BizObj to a WizardPage?  I
>> can't
>> seem to figure out how it should work.  Maybe I'm going down the wrong
>> path...
>
>
> Have you added the bizobj to the wizard form? What have you tried so
> far?
>
> -- Ed Leafe

I overrode the createBizobjs in the Wizard sub-class (which controls all
the pages, correct?).

So, it looks like this:

def createBizobjs(self):
  locationBO = self.Application.biz.Location(self.Application.dbConnection)
  self.addBizobj(locationBO)

Now I'm getting an error that Wizard doesn't have addBizobj, which makes
sense, as it's not listed in the docs either.

Dave



_______________________________________________
Post Messages to: Dabo-users@...
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/ac7a611518b024e5121655360fe35bb4@...

Re: WizardPage - BizObj Examples

by Ed Leafe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sep 30, 2008, at 7:29 PM, <dave@...> <dave@...>  
wrote:

>> Have you added the bizobj to the wizard form? What have you tried so
>> far?
>>
>> -- Ed Leafe
>
> I overrode the createBizobjs in the Wizard sub-class (which controls  
> all
> the pages, correct?).
>
> So, it looks like this:
>
> def createBizobjs(self):
> locationBO =  
> self.Application.biz.Location(self.Application.dbConnection)
> self.addBizobj(locationBO)
>
> Now I'm getting an error that Wizard doesn't have addBizobj, which  
> makes
> sense, as it's not listed in the docs either.

        Ah, my mistake. The Wizard form is based on the dialog class, not the  
form class.

        If you don't need the wizard to be run modally, you can use a  
dPageFrameNoTabs to create wizard-like behavior in a normal form.

-- Ed Leafe





_______________________________________________
Post Messages to: Dabo-users@...
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/DC6AF6C2-9846-4E38-8D80-FDCF8D4AA217@...

Re: WizardPage - BizObj Examples

by Dave Rowe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 30 Sep 2008 19:33:35 -0500, Ed Leafe <ed@...> wrote:
>
> Ah, my mistake. The Wizard form is based on the dialog class, not the
> form class.
>
> If you don't need the wizard to be run modally, you can use a
> dPageFrameNoTabs to create wizard-like behavior in a normal form.
>
> -- Ed Leafe
>

So, is there not a way to tie the inputs on the WizardPage to the BizObj,
such that it binds, and saves a new record upon clicking 'Next' or
'Finish'?  Would the best practice (if still using the Wizard) to manually
build the INSERT statement?  I'm not opposed to it, necessarily, just want
to make sure I'm not violating a design rule in Dabo or something :)

Thanks,
Dave



_______________________________________________
Post Messages to: Dabo-users@...
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/0f1c136b7b3b163d472a974065cbdfec@...

Re: WizardPage - BizObj Examples

by johnf :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tuesday 30 September 2008 05:37:26 pm Dave Rowe wrote:

> On Tue, 30 Sep 2008 19:33:35 -0500, Ed Leafe <ed@...> wrote:
> > Ah, my mistake. The Wizard form is based on the dialog class, not the
> > form class.
> >
> > If you don't need the wizard to be run modally, you can use a
> > dPageFrameNoTabs to create wizard-like behavior in a normal form.
> >
> > -- Ed Leafe
>
> So, is there not a way to tie the inputs on the WizardPage to the BizObj,
> such that it binds, and saves a new record upon clicking 'Next' or
> 'Finish'?  Would the best practice (if still using the Wizard) to manually
> build the INSERT statement?  I'm not opposed to it, necessarily, just want
> to make sure I'm not violating a design rule in Dabo or something :)
>
> Thanks,
> Dave

You could subclass the dialog and pass 'self' to the subclassed dialog.  Don't
forget to call the super().  Since you passed the form (self) you can use it
within the Class.  

callingForm.PrimaryBizObj.new()
callingForm.PrimaryBizObj.setFieldVal('fieldName', value)
callingForm.save()

That said, I think you are best served by not using a dialog but a form.  What
I understood you want to call the wizard when the user opens the app for the
first time.  I'd have code that checked the user preferrence DB for a flag or
some field.  If the flag/field was "this is the first time" I'd call my form.  
Check out "dUserSettingProvider.py" for how to use the settings.



--
John Fabiani


_______________________________________________
Post Messages to: Dabo-users@...
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/200809301916.16009.jfabiani@...

Re: WizardPage - BizObj Examples

by Ed Leafe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sep 30, 2008, at 7:37 PM, Dave Rowe wrote:

> So, is there not a way to tie the inputs on the WizardPage to the  
> BizObj,
> such that it binds, and saves a new record upon clicking 'Next' or
> 'Finish'?  Would the best practice (if still using the Wizard) to  
> manually
> build the INSERT statement?  I'm not opposed to it, necessarily,  
> just want
> to make sure I'm not violating a design rule in Dabo or something :)

        The data binding code was originally written only in the dForm class,  
with the hope that we would be able to display that class in either a  
modal or modeless state. Turned out the wxPython doesn't support modal  
display of their wxFrame class. There has been discussion of  
refactoring out the bizobj/data handling code from the dForm and  
mixing it into both dForm and dDialog, but that's a HUGE undertaking  
that would potentially break every existing app. So far we simply  
haven't had the time to do that.

        Dabo is built on a three-tier design: UI, business logic, and data  
access. If you ever find yourself writing code in one layer that  
handles the inner workings of another, you're probably doing it wrong.

        You *can* add a bizobj to a wizard, but you'll have handle the  
internal references, such as getBizobj() and PrimaryBizobj yourself.  
You'll also have to make sure that the form's update() method is  
called as needed to populate the bound controls with the current data  
from the bizobj. It's not a prohibitive task; just be aware that there  
may be quirks in your app if you forget to handle something. I'll be  
happy to help you if you want to try.

-- Ed Leafe





_______________________________________________
Post Messages to: Dabo-users@...
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/3DD474EF-48F9-4797-8FFF-54BD91E5AB92@...
LightInTheBox - Buy quality products at wholesale price!