main logo
Subject: Re: [dabo-users] Simple GUI with interrelated controls
Author: Paul McNett

Posted: 2007/05/31 14:04:04
 
View Entire Thread
New Search


Brendan Barnwell wrote:
> I joined this list a long time ago when Dabo was first starting but then left
> because I stopped using Dabo, but now I'm taking another shot.

Cool; welcome back!

> I'm having sort of the same problem I had before, which is that I can't find
> any information on how to set up simple GUI apps that DON'T require a database
> or a large collection of "records", but just involve a set of GUI widgets that
> interact with one another.

Yes; docs are still lacking. There aren't any docs that I know of that
specifically answer your question, but the Dabo Wiki has probably filled
out some since you last visited:

http://dabodev.com/wiki


> What I'm trying to do right now is create a small app that works sort of like a
> tiny spreadsheet. I want a few spinner boxes with numbers in them, and I want
> to be able to twiddle the numbers and have some other text in the window update
> based on some functions I specify, and maybe a few buttons and radio buttons
> that I can hit to toggle between a few different behaviors.

You can define properties of your Form that hold the values of your
text, and then use the fget/fset of those properties to call the
functions you need. Then, bind the dSpinner's DataSource to "self.Form"
and DataField to "<property_name>". When the spinner needs to find out
its current value, it'll get it from your property, and when the user
changes the spinner's value, it'll set it to your property automatically.

> I was pleased at how quickly I was able to set up a basic app by copying from
> the demo scripts, but I noticed a few things.
>
> In simpleDemo2.py, I see that the slider's DataSource is set to the Caption of
> the label that displays the slider value. But this seems backwards to me --- it
> seems like what's really happening is the label is getting its Caption from the
> slider value. Then I found out that I can do a DynamicCaption so it does
> exactly that, but I'm curious what is going on with this setup in the demo.

Data binding is two-way. Even though it is called DataSource, it pushes
values to that source as well as pulls values from it.


> At first I started thinking I could use a bunch of DynamicCaptions and stuff to
> get certain widgets to update based on the state of other widgets, but then I
> thought that would get really unwieldy. If I understand correctly, this is what
> a bizObj is for --- to serve as a sort of manager for the data from various
> widgets. What I'd like is to have an object (a bizObj?) that is linked to the
> widgets, so that, for instance, the current value of my number spinner is stored
> in myObj.spinValue and the current value of some other caption in the window is
> taken from myObj.getLabelText (which I can write as a method to manipulate the
> spinner data and output the value I want). However, I can't find any
> documentation that says "here is how you link a bizObj to a bunch GUI controls,
> and here is how you set up some GUI controls to put their data into the bizObj
> and others to take data out". All the bizObj stuff I see filled with database
> references that I'm not interested in for this application.

The thing about our bizobjs is that they really do assume connection to
a backend database. My thought in reading your message is that you'd
actually benefit from using a database (sqlite, in-memory, if nothing
else), because you are in effect manipulating data.

But if you really don't want to involve a database in the mix, it would
probably be simpler to create your own biz object that holds all your
functions and such.

> So, how can I set up such a system?

I only have time to give general guidance currently. Can you come back
with specific questions after trying out some ideas?

Paul


--
pkm ~ http://paulmcnett.com



 
©2007 Paul McNett
<-- Prior Message New Search Next Message -->