Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing values to another form.
Message
From
27/07/1998 03:45:46
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
26/07/1998 09:16:36
Jeroen Naus
Harte-Hanks Europe
Hasselt, Belgium
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00119709
Message ID:
00121564
Views:
19
>Little Tip here.
>
>If you create a method on your form that sets and gets certain properties. You can pass the form instead of the parameter. Your Init would look something like this:
>
>LPARAMETER loForm
>IF TYPE("loForm") = "O" && You can use Vartype here if you use VFP 6.0
> lnProperty = loForm.getColor()
> thisform.formref = loForm && Store the form that was passed
>ELSE
> lnProperty = RGB(250,250,250)
>ENDIF
>
>In the end if you want to change the property you can do.
>
>IF TYPE("thisform.formref.name") = "C" && Check if the form still exist
> thisform.formref.setColor(thisform.color)
>ENDIF
>
>This way your form will work on all forms that have a method like that and it will allow you to reuse your original form.
Jeroen,
Good tip. Beware this code is open to potential errors (ie: loForm might be "O" type but .null.). And in addition, instead of couple of methods per property, you could have just one custom generic method that would check if exists property, RO, protected etc and get/set property for any object in form passed.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform