|
Home > Archive > Programming with dBASE > February 2006 > How to create instance of form already open?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to create instance of form already open?
|
|
| Bosco Wilson 2006-02-21, 9:23 am |
| I'm trying to call "form.rowset.next(0)" on a form that is already open,
from another form. For example:
Form 1 is open.
I open form 2 from form 1 and input data.
I close form 2 and want to call "form.rowset.next(0)" on form 1 (on close of
form2)
How do I create an object reference for form 1 from form 2 when it is
already open? Maybe an _app object?
Thanks for any ideas!
Bosco
| |
|
| Bosco Wilson wrote:
> I'm trying to call "form.rowset.next(0)" on a form that is already open,
> from another form. For example:
>
> Form 1 is open.
> I open form 2 from form 1 and input data.
> I close form 2 and want to call "form.rowset.next(0)" on form 1 (on close of
> form2)
>
> How do I create an object reference for form 1 from form 2 when it is
> already open? Maybe an _app object?
>
> Thanks for any ideas!
>
> Bosco
>
>
An _app would work, also could assign the form to a variable in form2,
say form2.calling = form1 (not exact syntax!). You also could call the
form.rowset.next(0) in the calling statement in form1:
pushbutton1_onclick
---- setup
form2.open()
form.rowset.next(0)
return
HTH
Glenn Fausel
| |
| Ken Mayer [dBVIPS] 2006-02-21, 9:23 am |
| Bosco Wilson wrote:
> I'm trying to call "form.rowset.next(0)" on a form that is already open,
> from another form. For example:
>
> Form 1 is open.
> I open form 2 from form 1 and input data.
> I close form 2 and want to call "form.rowset.next(0)" on form 1 (on close of
> form2)
>
> How do I create an object reference for form 1 from form 2 when it is
> already open? Maybe an _app object?
You need to have a reference to that form available to the form that is
calling it.
You can't create a reference if the form is already open, at least not
easily. If you open your forms with:
do MyForm.wfm
It's harder to get those references. However, if you instantiate your
report in this fashion:
set proc to MyForm.wfm additive
fMyForm = new MyFormForm()
fMyForm.open()
Then from the other form, you should be able to reference this, but only
if the reference is available to the form.
Now, if the form you want to change was open, and the user called
another form, you can handle this this way:
set proc to MySecondForm.wfm addi
fForm2 = new MySecondFormForm()
fForm2.parentform = this
fForm2.open()
And then in the code in the second form, you now have a reference to the
first form, and can do things like:
form.parentForm.rowset.first()
And so on.
However, as I was typing this, I remembered the FindInstance() function
.... you might want to look at that as well. <g>
The topic of forms talking to each other is covered in my book ...
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Bosco Wilson 2006-02-25, 9:36 am |
| Thanks for the info. Exactly what I was looking for!
Bosco
"Ken Mayer [dBVIPS]" < dbase@_nospam_golden
stag.net> wrote in message
news:wTkWa0uNGHA.2016@news-server...
> Bosco Wilson wrote:
>
> You need to have a reference to that form available to the form that is
> calling it.
>
> You can't create a reference if the form is already open, at least not
> easily. If you open your forms with:
>
> do MyForm.wfm
>
> It's harder to get those references. However, if you instantiate your
> report in this fashion:
>
> set proc to MyForm.wfm additive
> fMyForm = new MyFormForm()
> fMyForm.open()
>
> Then from the other form, you should be able to reference this, but only
> if the reference is available to the form.
>
> Now, if the form you want to change was open, and the user called another
> form, you can handle this this way:
>
> set proc to MySecondForm.wfm addi
> fForm2 = new MySecondFormForm()
> fForm2.parentform = this
> fForm2.open()
>
> And then in the code in the second form, you now have a reference to the
> first form, and can do things like:
>
> form.parentForm.rowset.first()
>
> And so on.
>
> However, as I was typing this, I remembered the FindInstance() function
> ... you might want to look at that as well. <g>
>
> The topic of forms talking to each other is covered in my book ...
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/dbase/dBASEBook.htm
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase
|
|
|
|
|