Discussion:
Running a form
(too old to reply)
Winston Doyle
2008-11-20 05:44:36 UTC
Permalink
I have a program (addacust.wfm) which adds new customers
What is the difference between?

a. do addacust.wfo

b. set procedure to :forms:addacust.wfo additive
faddacust = new addacustForm()
faddacust.open()


both appear to do the same job!
Ken Mayer [dBVIPS]
2008-11-20 05:57:49 UTC
Permalink
Post by Winston Doyle
I have a program (addacust.wfm) which adds new customers
What is the difference between?
a. do addacust.wfo
b. set procedure to :forms:addacust.wfo additive
faddacust = new addacustForm()
faddacust.open()
both appear to do the same job!
The advantage to the latter is that you have a name for the form object
that you can refer to in other code. For example, if in one form, you
wish to open "AddACust.wfo", and refer to it, and perhaps grab a value
from the form, you can -- i.e.:

fAddACust.mdi := false
fAddACust.readModal() // open it as a modal form
// when it closes:
? fAddACust.rowset.fields["CustomerName"].value

Just a simple thing here, but think about it a bit, and hopefully you'll
see there's a LOT you can do from there.

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/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
http://www.goldenstag.net/dbase
Winston Doyle
2008-11-20 20:24:44 UTC
Permalink
Post by Ken Mayer [dBVIPS]
Post by Winston Doyle
I have a program (addacust.wfm) which adds new customers
What is the difference between?
a. do addacust.wfo
b. set procedure to :forms:addacust.wfo additive
faddacust = new addacustForm()
faddacust.open()
both appear to do the same job!
The advantage to the latter is that you have a name for the form object
that you can refer to in other code. For example, if in one form, you
wish to open "AddACust.wfo", and refer to it, and perhaps grab a value
fAddACust.mdi := false
fAddACust.readModal() // open it as a modal form
? fAddACust.rowset.fields["CustomerName"].value
Just a simple thing here, but think about it a bit, and hopefully you'll
see there's a LOT you can do from there.
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/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
http://www.goldenstag.net/dbase
A big help. Thanks. That will make a massive difference to my program.
Greg Hill
2008-11-20 07:21:40 UTC
Permalink
To add to what Ken said:
You can control the form through the object faddacust, ex:
faddacust.top = 0
?faddacust.entryfield1.value // display the value of a field or store ito
to a variable

You can use do addacust.wfo and then later get control of it as follows:
do addacust.wfm
oAddacust = findinstance('addacustform')
oAddacust.top = 10

Greg Hill
Post by Winston Doyle
I have a program (addacust.wfm) which adds new customers
What is the difference between?
a. do addacust.wfo
b. set procedure to :forms:addacust.wfo additive
faddacust = new addacustForm()
faddacust.open()
both appear to do the same job!
Loading...