On Jan 16, 2007, at 2:05 PM, johnf wrote:
> OK I'm back where I started. I'm again asking how to call a form
> class from
> within form function. But below is the app.
> import os
> import inspect
> import dabo
> import johnClasses
>
[snip]
>
> A function in the form
> def lookup():
> new_frm = johnClasses.TestForm()
> new_frm.showModal()
OK, based on what you wrote, the form that contains this lookup
function is a cdxml, right? That means that it is separate from the
program in which you define and run the app.
You simply need to get this whole namespace thing down, and what
happens when you use the import function. The simple answer to your
problem would be to add 'import johnClasses' to your cdxml's 'Manage
Imports' dialog, which will then make the 'johnClasses' name
available in the form's namespace.
If I could draw an analogy to VFP, you're thinking of Python's
import as being similar to SET PROCEDURE TO, in that once it's set,
it's available everywhere. It's actually closer in scope to VFP's
#DEFINE statement, which only works in the prg/class in which it is
declared.
-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev