On 4/15/11 12:13 PM, Nick Raptis wrote:
> As this is my first time writing to the list, first let me say hello to
> all the developers and users.
> I'm quite new to Dabo and let me say it looks like a great tool and
> really easy and usable.
>
> I'm trying to make an application that strays from the Dabo main focus
> of database apps and using it just for it's powerful UI tier. Since I'm
> quite new to Dabo I'd like some help searching for some specific stuff
> in the documentation (and source code).
>
> My test case (to give some context) is this:
> I'd like my app to control some external hardware (namely an Arduino
> microcontroller) via a custom protocol on top of a serial connection.
> The ui elements will raise events for my protocol handler to send to the
> hardware and incoming information from the hardware will be raised as
> events to update the ui elements.
>
> So my first question is where in the documentation should I start
> looking about raising custom events and binding to them? What should my
> on(Event) methods be named like? Is there some sample code that uses
> these and what classes should I look first in the documentation?

Not sure the documentation will be much help here, unless there are wiki pages 
I'm 
unaware of.

To create a custom event:

        class MyCustomEvent(dabo.dEvent): pass

To bind to it:

        class MyTextBox(dabo.ui.dTextBox):
                def initEvents(self):
                        self.bindEvent(MyCustomEvent, self.onMyCustomEvent)

                def onMyCustomEvent(self, evt):
                        print "hi", evt.EventData

This is simplistic, meant to get you started.


> My second set of questions comes from my need to check periodically
> whether the hardware has sent any new information. Now, this is nowhere
> near a realtime application, so checking in grossly timed intervals is ok.
> Dabo from what little I've played with it feels like it has an
> asynchronous loop, but I really can't tell yet. Since the connection to
> the external hardware is non-blocking, it be great if I could just poll
> it somehow.

Use a dabo.ui.dTimer. Set Interval to say 10000 for 10 seconds. Catch the Hit 
event 
and poll.

> But even if it isn't asynchronous, I'd be simple to do the job with a
> timed event that fires every once in a while.
> So, I'd appreciate what you can share about the main event loop
> specifics and/or timed events.

The loop is event-driven. We can't predict when our code will run. Actually, we 
can 
predict it: it runs in response to events.

> Hope that post wasn't too long, or too incomprehensible..
> Thanks for your time and keep up the good work,

Thank you, and hopefully my code isn't too simplistic, but you have to start 
somewhere!

Paul
_______________________________________________
Post Messages to: [email protected]
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/[email protected]

Reply via email to