Subject Re: calling part of .wfm from another .prg
From Bruce Beacham <bbeacham@no-plm-lowman.co.uk>
Date Wed, 29 Dec 2021 18:46:16 +0000
Newsgroups dbase.getting-started

Pass a parameter when you call the method form_onOpen from another
function, or another form's method.
Then in the function form_onOpen you test for the type of the variable
'form'.
If it is not known, then the parameter is the object (usually another
form) which carries the properties you wish to retrieve.    If it is
known, then your alternative route is ignored.

Thus:

FUNCTION form_onOpen

parameter fm                // this will be a private variable.

if type("form") = "O"
        fm = form
endif

nCol = fm.grid1.currentcolumn

....and so on.


Bruce Beacham

On 29/12/2021 17:39, Milind Nighojkar wrote:
> Scenerio:
> There are few .wfm statements in    function GRID1_onOpen()
> nCol = form.grid1.currentcolumn
> m_COL_name = 'COLUMN'+ltrim(rtrim(str(1)))
>
> Want to call these 2 statements from external .prg say temp.prg
>
> Issue seen
> When temp.prg is called in  function GRID1_onOpen() get error message saying 'variable form not defined'
>
> Any suggestions?
>
> Milind Nighojkar