VISUAL FOXPRO IDE >> _SCREEN.ACTIVEFORM ... HOLD ON!
Just by accident I found this and wanted to let you all know.
Whenever you run a form from the command window you can access it like
Another option is to start the form like:
You can then access it with MF.Controls(1).value = "someValue"
HOWEVER, I just found a shorter way.
so you start the form:
You can now access this form simply with referring it as "MyForm".
So, assuming there is a property (SomeProp) on the form with a value in it you can now type
to see the value of the textbox. Also, the IntelliSense works properly with this.
I tested this in VFP9, I do not know how previous versions will work with this.
Eric den Doop
@ 4/16/2008 12:10:51 PM
I'm affraid this shorter way is going to get a bit nasty if you run multiple instances of the same form.
Eric den Doop
@ 4/16/2008 12:20:01 PM
Oops.. hit the post button too soon... What I was trying to say is that if you run DO FORM MyForm more than once, the MyForm reference is only valid for the first instance. All other instances are there without a memvar reference. By specifying a unique NAME for each instance of that form, you have a reference for all instances, not just the first.
@ 4/16/2008 2:07:56 PM
Sorry Boud but this is NOT a good idea!
Apart from the multiple instance issues, you have also got the issue that if you do this in the command window the reference is created, like all variables, as PUBLIC. Anywhere else it is private and so you cannot acces it.
If you must reference a form use a unique name and use the DO FORM .... NAME ... command.
This shortcut will bite you!
@ 4/22/2008 5:16:55 PM
Sure enough if one runs multiple forms this is not quite way to go, I agree completely.
However, in testing a form I never run the same form more than once.
In that situation you can use the idea I posted here. Eric and Andy are right about this. Tx BTW abdy to make my name a four letter word, it gives the feeling that I am on an equal level with you ( 4 letter name) and eric (likewise)
@ 8/28/2008 4:43:07 PM
i'm agree with you, but if you run the same form with differente name where 'll be the probleme
Do form MyForm name MF
Do form MyForm name MF1
Do form MyForm name MF2
and then you can manipulatig form just with mf1.someprop.value.......
or am i wrong????
@ 11/15/2008 10:40:32 PM
If you don't use the 'Name' reference, vfp makes the name of the form the 'Name'.... makes sense.... works in vfp6
Enter the code shown: