Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Visibility of variables inside a form
Message
From
14/05/2008 03:19:12
 
 
To
14/05/2008 02:23:16
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01316626
Message ID:
01316899
Views:
20
In addition to my previous post you could do this in form.init:
LPARAMETERS vXMLStream as String
XMLTOCURSOR(m.vXMLStream,[crsTemp],4)
Thisform.addproperty([myParams])
SELECT crsMyParams
SCATTER NAME Thisform.myParams
USE IN SELECT([crsTemp])
Now you can access all Fields like this:
IF Thisform.myParams.myField1 == [Textvalue]
    * Do something here
ENDIF
IF Thisform.myParams.myField2 = 1234
    * Do something here
ENDIF
IF Thisform.myParams.myField3 = DATE()
    * Do something here
ENDIF
>Hi Tony,
>
>>So, even I have variables passed to the form is it better
>>to add properties and put the variables values on them?
>
>Definetely yes and no :-)
>
>Yes, when you don't want those passed variables to be seen outside the form.
>No, when you use a parameterobject, that's i.e. added to _screen like this:
>
>
>_screen.addobject([oParameters],[myParamObject])
>
>
>>Another question:
>>How to deal with the type of the values (string, numeric,
>>date, etc)?
>
>Where's the difference? For a property those are only values that get stored in it. Now it's a date, next time it will be an integer. VFP doesn't know strong typing, so the type of value is defined when you store it.
>
>I will give you an idea of working with parameters on a rather flexible basis.
>
>Create a cursor that contains all the values, that you need in your form. Next insert all the values into that cursor.
>
>
>CREATE CURSOR crsMyParams (myfield1 c(10), myField2 i, myField3 d)
>m.myField1 = [Textvalue]
>m.myField2 = 1234
>m.myField3 = DATE()
>INSERT INTO crsMyParams FROM MEMVAR
>
>
>Now you've got a cursor that, as long as you don't use private datasessions, can be accessed by any form in your project. When using private datasessions just add this line of code:
>
>
>CURSORTOXML([crsMyParams],[cXMLParams],1,1+2+4+8,0,[1])
>
>
>Now you've got ONE variable which contains up to 255 parameters. Call your form with this string as a parameter and your form/app can access the values simply by converting the XML back to a cursor.
Best Regards
-Tom

Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.

Oh, and BTW: 010101100100011001010000011110000101001001101111011000110110101101110011
Previous
Reply
Map
View

Click here to load this message in the networking platform