On Dec 19, 2007, at 9:19 AM, Dennis Meulensteen wrote:
> I know that I can use the Class Designer's Object Info panel to
> view the
> relationships between graphical objects. I know how to use
> self.Form to get
> to those objects and their properties.
>
> But how on earth do I create a button that calls a BuzObj's
> SetWhere method?
> Dabo keeps telling me there's no such global object whenever I call
> the
> BusObj by name. Whatever I prefix it with doesn't seem to help
> either, I've
> tried self.Form and such, but no luck.
The concept that's tripping you up is that you are trying to make a
button smarter and more responsible than it really should be. Buttons
and other UI elements should simply display the information they're
given, and report user interaction where appropriate to the "proper
authorities". In 99% of the cases, UI elements should respond to user
events by calling a form method.
The form is a lot "smarter" than any of its controls, and
"knows"about its bizobjs and how to talk to them.
So in your case, the button should only tell the form that it has
been clicked. After that, the button's job is done. It does this by
calling the appropriate form method; it is in this method that you
handle the communication with the bizobj.
While typing this, I see that John has responded to your question,
and with all due respect, his answer is wrong. Buttons should never
"know" about bizobjs, much less try to directly manipulate them. They
should talk with the form, and occasionally to sibling controls, but
never beyond that.
This may seem like an odd way to do things, but it is a standard
software Design Pattern named "Chain of Responsibility". Essentially,
it means that each object knows what it can handle itself, and where
to pass any other requests that it can't handle. In this case, the
button tells the form that it's been clicked; the form uses that
information to tell the appropriate bizobj to set its Where clause to
the current value; the bizobj uses that information to update the
appropriate cursor with the filter expression passed by the form.
-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
_______________________________________________
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/dabo-users/[EMAIL PROTECTED]