Multiple Forms

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

Multiple Forms

by pmac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello

I am using Class Designer to design multiple forms.
I have Form A set up and all it's Biz Objects bound and working. I
create Form B.

If I call Form B from Form A with dabo.ui.createForm("FormB",show=True),
does code created for Form B also come along for the ride?

Do Biz objects instantiated in Form A retain state in the new formB?

Thanks

Paul McNary
pmcnary@...


_______________________________________________
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/48828AA2.2020007@...

Re: Multiple Forms

by Ed Leafe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Jul 19, 2008, at 7:45 PM, Paul McNary wrote:

> I am using Class Designer to design multiple forms.
> I have Form A set up and all it's Biz Objects bound and working. I
> create Form B.
>
> If I call Form B from Form A with  
> dabo.ui.createForm("FormB",show=True),
> does code created for Form B also come along for the ride?

        Of course.

> Do Biz objects instantiated in Form A retain state in the new formB?

        Well, the answer is a great big "it depends". Are you creating new  
instances of those bizobjs in formB? If so, they are independent  
objects, right? Changing one won't change the other. But if you pass  
the formA bizobj to formB, then they are the same object, and so the  
state is the same.

-- 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/759C5205-F652-4991-A86A-B3137B5FD786@...

Re: Multiple Forms

by pmac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ed Leafe wrote:

> On Jul 19, 2008, at 7:45 PM, Paul McNary wrote:
>
>> I am using Class Designer to design multiple forms.
>> I have Form A set up and all it's Biz Objects bound and working. I
>> create Form B.
>>
>> If I call Form B from Form A with dabo.ui.createForm("FormB",show=True),
>> does code created for Form B also come along for the ride?
>
>     Of course.
>
>> Do Biz objects instantiated in Form A retain state in the new formB?
>
>     Well, the answer is a great big "it depends". Are you creating new
> instances of those bizobjs in formB? If so, they are independent
> objects, right? Changing one won't change the other. But if you pass the
> formA bizobj to formB, then they are the same object, and so the state
> is the same.
>
> -- Ed Leafe
>
>
>
>
>
Hello Ed

Below is an answer you gave last year to Nate wanting to pass values
between forms:
----------------------------------------
Just pass it an object reference.

FormA = dabo.ui.dForm(self)
FormB = dabo.ui.dForm(self)

#control code

FormA.PassedValue = FormB.txtBox.Value

or do it this way:

FormA.PassedObj = FormB.txtBox
FormA.PassedObj.Value
----------------------------------------
Where would these lines be put?

FormA = dabo.ui.dForm(self)
FormB = dabo.ui.dForm(self)

and then are they globally referenced or do they have to be qualified by
something else?

And then further clarification from above, How do you pass the formA Biz
object to formB?

Thank you

Paul McNary
pmcnary@...


_______________________________________________
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/48839B39.8070602@...

Re: Multiple Forms

by Ed Leafe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Jul 20, 2008, at 3:08 PM, Paul McNary wrote:

> Where would these lines be put?
>
> FormA = dabo.ui.dForm(self)
> FormB = dabo.ui.dForm(self)
>
> and then are they globally referenced or do they have to be  
> qualified by
> something else?

        In order to answer that, I would need to know your application  
design. In your code above, what exactly is 'self' referring to?

> And then further clarification from above, How do you pass the formA  
> Biz
> object to formB?

        One way is to use the addBizobj() method of formB:

        formB.addBizobj(formA.getBizobj("MyBizobjDataSource"))

Now the bizobj will be registered with formB, and controls on formB  
can bind to it by simply referencing the DataSource.

-- 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/D2B0C3B5-7437-477A-B5E2-B31EF9884922@...

Re: Multiple Forms

by pmac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ed Leafe wrote:

> On Jul 20, 2008, at 3:08 PM, Paul McNary wrote:
>
>> Where would these lines be put?
>>
>> FormA = dabo.ui.dForm(self)
>> FormB = dabo.ui.dForm(self)
>>
>> and then are they globally referenced or do they have to be qualified by
>> something else?
>
>     In order to answer that, I would need to know your application
> design. In your code above, what exactly is 'self' referring to?
>
>> And then further clarification from above, How do you pass the formA Biz
>> object to formB?
>
>     One way is to use the addBizobj() method of formB:
>
>     formB.addBizobj(formA.getBizobj("MyBizobjDataSource"))
>
> Now the bizobj will be registered with formB, and controls on formB can
> bind to it by simply referencing the DataSource.
>
> -- Ed Leafe
>
That was my question when I read your answer. I needed more details
about multiple form interaction. Let's set up a scenario. FormA is
created with Class Designer with Biz object. At that point I would
reference it as self.Form. Now I instantiate a new form from
FormA.afterInit with :
FormB = dabo.ui.createForm("FormB.cdxml",parent=??????)

What do I use for the question marks at this point?
If I use parent=self, then how do I reference FormB, like for
FormB.show? I tried self.Form.frmBatch.show=True and it says FormA has
not attribute FormB.

Is parent child forms the right way or 2 independent forms?
This is for child database table entries.

Thank you

Paul McNary
pmcnary@...


_______________________________________________
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/4883B553.3030302@...

Re: Multiple Forms

by Uwe Grauer-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Paul McNary wrote:

> Ed Leafe wrote:
>> On Jul 20, 2008, at 3:08 PM, Paul McNary wrote:
>>
>>> Where would these lines be put?
>>>
>>> FormA = dabo.ui.dForm(self)
>>> FormB = dabo.ui.dForm(self)
>>>
>>> and then are they globally referenced or do they have to be qualified by
>>> something else?
>>     In order to answer that, I would need to know your application
>> design. In your code above, what exactly is 'self' referring to?
>>
>>> And then further clarification from above, How do you pass the formA Biz
>>> object to formB?
>>     One way is to use the addBizobj() method of formB:
>>
>>     formB.addBizobj(formA.getBizobj("MyBizobjDataSource"))
>>
>> Now the bizobj will be registered with formB, and controls on formB can
>> bind to it by simply referencing the DataSource.
>>
>> -- Ed Leafe
>>
> That was my question when I read your answer. I needed more details
> about multiple form interaction. Let's set up a scenario. FormA is
> created with Class Designer with Biz object. At that point I would
> reference it as self.Form. Now I instantiate a new form from
> FormA.afterInit with :
> FormB = dabo.ui.createForm("FormB.cdxml",parent=??????)
>
> What do I use for the question marks at this point?
> If I use parent=self, then how do I reference FormB, like for
> FormB.show? I tried self.Form.frmBatch.show=True and it says FormA has
> not attribute FormB.
>
> Is parent child forms the right way or 2 independent forms?
> This is for child database table entries.
>
> Thank you
>
> Paul McNary
> pmcnary@...
>

You can use user defined properties for this.
Here is a example for handcoded forms:

# we want to call a EditForm from a browser form
# this also works for dabo.ui.createForm(...)
def callEditPer(self):
        frm = EditPerForm.EditPerForm(ParentForm=self)
        frm.show()

# in EditPerForm we have:
def _getParentForm(self):
        try:
          return self._parentForm
        except AttributeError:
                return None
def _setParentForm(self, val):
        self._parentForm = val

ParentForm = property(_getParentForm, _setParentForm, None,
                       _("""Reference to the parent form (dForm)"""))

Of cause this technique can be used to pass bizobjs too.

Uwe




_______________________________________________
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/48845A68.2080502@...

Re: Multiple Forms

by Ed Leafe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Jul 20, 2008, at 4:59 PM, Paul McNary wrote:

> That was my question when I read your answer. I needed more details
> about multiple form interaction. Let's set up a scenario. FormA is
> created with Class Designer with Biz object. At that point I would
> reference it as self.Form. Now I instantiate a new form from
> FormA.afterInit with :
> FormB = dabo.ui.createForm("FormB.cdxml",parent=??????)
> What do I use for the question marks at this point?

        Depends. Do you want FormB to automatically be closed when FormA is  
closed? Then make FormA the parent. Do you want them to be  
independent? Then make FormB's parent None.

> If I use parent=self, then how do I reference FormB, like for
> FormB.show? I tried self.Form.frmBatch.show=True and it says FormA has
> not attribute FormB.

        That's basic Python referencing. If you want to be able to reference  
FormB from FormA, when you create it, you would store the reference as  
an attribute of FormA. You can call the attribute whatever makes sense:

self.formB = dabo.ui.createForm("FormB.cdxml")

> Is parent child forms the right way or 2 independent forms?
> This is for child database table entries.

        Database parent-child doesn't have anything to do with form parent-
child. Setting one form as the parent of another only means that the  
child will be destroyed when the parent is closed.

-- 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/6661C39F-9566-4D50-9EF1-302311D749BE@...
LightInTheBox - Buy quality products at wholesale price