Thanks Ed,
That clears up my misconceptions now. Sorry to divert your attention but I'm
determined to get into Dabo and now I've started I'm really really
impressed. Well done to all the team and here's hoping I can contribute in
the future.

For your interest I've now got a Dabo form with a grid of data taken from my
mySQL server which refreshes itself via a timer. The timer is a small class
that I've put together which runs in its own thread and triggers the refresh
automatically just like a VFP timer but without suppressing all the form
events when it activates. I couldn't find a dabo "timer" so maybe this is
something I can let you have.

My aim is to replace the front end on our Time and Attendance system to use
Dabo. In it I show all the employees who are in the factory in a grid. Once
this is finished I'll add in the swiping in for the employees which will add
the attendance record back to the server and mark them as in or out at a
particular time (reflected in the grid).

I'll keep you all posted and probably busy with my questions no doubt. I've
also just used the RegID property of the screen objects to bind in events to
the buttons I create programmatically on the form. This may well not be the
best way to do it but it works nevertheless.

All in all its looking rather cool and I'll put together a Flash Video of
the product as I progress along with a writeup for anyone else who takes the
plunge.

Dave Crozier

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Ed Leafe
Sent: 04 January 2007 16:46
To: Dabo Users list
Subject: Re: [dabo-users] How to reference contained objects

On Jan 4, 2007, at 11:18 AM, Dave Crozier wrote:

> In that case is there a problem with the objects when they are  
> simply placed
> onto a form.
>
> i.e if you create a panel in a form using
> panel=self.addObject(dabo.ui.dPanel)it isn't bound to the form  
> itself by the
> name "panel" in any way unless you create it using self.panel.

        It is bound, but not by the local 'panel' reference in your code.

        Every Dabo control has a Name property. If you don't supply a value

for this when the object is created, it will be created using the  
class name plus an incremental integer for uniqueness. Hence, if you  
create 3 textboxes on a form, they will be given names 'dTextBox',  
'dTextBox1', and 'dTextBox2'.

        To see what I mean, take your code and add one more line:

panel = self.addObject(dabo.ui.dPanel)
print panel.Name

> Are you saying that panel=self.addObject(dabo.ui.dPanel) when  
> created in a
> method should create the object so it can be referenced outside the  
> method
> as self.panel (which is what I was assuming when testing)? If so, it
> doesn't.

        No, what I'm saying is that you can reference it outside of the  
method in which it was created as <formReference>.<panel.Name>

        Let's say that if you run the code above, it prints 'dPanel' as the

value for panel.Name. Then from some other form method, you can  
reference 'self.dPanel'.

        As a slight digression under the hood, if you break down the code in

the statement:

panel = self.addObject(dabo.ui.dPanel)

what happens is that first self.addObject() is called with the class  
to be created. In that method it instantiates the object from the  
class definition, and in that process, the object is given a value  
for its Name property. The method then returns a reference to the  
newly-created object, and in the namespace of the calling method, the  
name 'panel' is assigned to this returned reference. That's why when  
the calling method exits, the local 'panel' reference is no longer  
defined.

        Here's something else to try:

panel = self.addObject(dabo.ui.dPanel, Name="razzamatazz")
print panel.Name
print self.razzamatazz.Name

        In this example, we are setting the Name explicitly.


-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users



-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.4/615 - Release Date: 03/01/2007
13:34




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Reply via email to