On Aug 8, 2009, at 11:31 AM, [email protected] wrote:
> What I'm really after is how to piece together an application. We're
> longtime VFP programmers, and what I'm trying to figure out is very
> basic: how
> to call one form from another, using your Class Designer. In VFP,
> the click
> method of a button will call another form with "do form FindRun" and
> then
> the FindRun form can process user input and move the pointer in a
> cursor or
> table that's in a grid on the calling form. The find function is
> just an
> example, the approach would be the same for other functions, such
> as buttons
> for "Export Results" or "Revise Status"
In general, the "trick" is to use dialogs for these sorts of helper
forms, and use the fact that such modal dialogs stop the process that
called them until the dialog is either hidden or destroyed. You then
make sure that the ok/cancel buttons only *hide* the dialog, and not
close/destroy it. The calling code looks something like this:
dlg = MyDialogClass()
dlg.show()
# execution pauses here until the dialog is hidden
if dlg.Accepted:
# User clicked OK
result = dlg.someAttributeThatHoldsTheResult
self.doSomethingWithIt(result)
dlg.release()
The 'Accepted' property will be set to True when the user clicks
'OK'; otherwise, it is False. In your dialog code, you need to store
the user's input/selection into an attribute, or add a method to fetch
that value, so that the calling form can act on that value. And once
you have gotten the information from the dialog, you need to manually
call release() to destroy it.
Hope that gives you a general idea how to do this. If you have any
other questions, ask away!
-- Ed Leafe
_______________________________________________
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]