>I'm storing the value of _CurrObj and then want to call the Valid of that field when a button is clicked on the form. Or highlight the field and let the user select it. How do I do that? Thanks!
It's been so long and I don't have copy of 2.6 where I am but.........
I don't think you can do this directly. If you create procedures/functions for the WHEN and VALID clauses for any GET they are stored as Functions within the SPR and are assigned random names when you generate the form.
What I used to do was create a separate function V_control() and W_control() in the screen's cleanup section. For a control's When and Valid clause I would use an expression
=V_control(). With this structure, your command button could also call
V_control() as part of it's valid function.
Converting a screen to this format was rarely more than an hour of cut and paste.
For example
@ row,column GET m.myvar1 WHEN w_myvar1() VALID v_myvar1()
@ row,column GET m.mycmd1 WHEN w_mycmd1() VALID v_mycmd1()
FUNCTION w_myvar1
code
code
RETURN .T. / .F.
FUNCTION v_myvar1
code
code
RETURN .T. / 0
FUNCTION w_mycmd1
code
code
RETURN T/F
FUNCTION v_mycmd1
=v_myvar1()
code
RETURN T/F
This is very similar to what is frequently done in VFP. If you need to call an object's valid code from somewhere, you place that code in a form method and then have the objects' valid method call the form method.
There a couple of side benefits to this. With all the code in one place (Cleanup snippet) searching the screen was simplified (I don't remember 2.6 having a Search all objects the way VFP does).
If you run a code comparison program you don't get hits on the difference in function names, which are regenerated every time you generate a new SPR.
Hope this helps
Your friendly 2.6 asaurus.........Rich