Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can I change the controlsource in the Init() of a object
Message
From
24/01/2000 11:53:09
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00321642
Message ID:
00321681
Views:
15
>I have this object with many textbox. All textbox are bound to a field. Ex:ControlSource=”MyAlias.MyField1” but in some case I need to change the alias to “IsAlias”.
>
>If I change the alias in the init() of the object I get a error because the alias “MyAlias” do not exist.
>Where is the best place to control the alias of controlsource?
>
>Passable solution:
>Having a subclass of the object with all control source change to the alias “IsAlias”.
>Coding the controlsource from the init() of the object for the right alias with a parameter.
>Using a cursor object in the form and control it from the loadevent() of the form.
>
>Any one can help me with this one!


Jean,
If you change the alias in init then it should be available (if you're setting it to IsAlias.MyField then IsAlias must be available). Before init form.load or form.de would open it. If you have situation where availability is postponed then create a method that would do it. Method :
-Checks availablity of alias.
-If exists loops through controls and sets controlsource to :
stuff(Controlsource,1,at(".",Controlsource)-1,"NewAlias")
(You might want to check if controlsource is in MyTable.MyField format)
-Refreshes control

Or alternatively if you're using DE :
-In DE change cursorsource and database of the cursor using "myAlias"
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
Next
Reply
Map
View

Click here to load this message in the networking platform