Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rename a custom property of my class?
Message
From
26/03/2009 10:08:57
 
 
To
26/03/2009 09:41:29
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01391579
Message ID:
01391588
Views:
48
Matt --

The result is as you fear, I believe.

When you rename the property in your base form class and then go revisit a form based on that class, you'll see that that property (with the new name) shows up as default -- not the value that you had set it to.

And, curiously, if you then go back to the base form class and change the name back -- presto, the values you set in the sub-class re-appear! (Not that it does you any good).

If this is really important, you can do the following:

(1) Instead of re-naming your property in your base class, just create the new property.

(2) Then, copy the old property value to the new one, as follows (invoke this for each form)
Modify Form (oFile.Name) Nowait
FixPropertyName()
Activate Window 'Form'
Keyboard '{CTRL+w}'
DoEvents

Procedure FixPropertyName
     Local laObjects(1), loForm
     ASelObj(laAobjects,1)
     loForm = laAobjects(1)
     loForm.(newpropertyname) = loForm.(oldpropertyname)
endproc
(3) Delete your old property.

This might be more work than is worth it. On the other hand, it's a nice technique to have



>Is there any way I can rename a property on my base form class so that it will not break all the forms based on that class that have overridden that property?
>
>I have a custom property named "form_title" that I wish I had named "cFormTitle", but every SCX form already has that property set to a value, and if I rename the property in my base class, won't that break the SCX file, as far as losing the value of that property?
>
>I know I can use the Code Refences to address the use of that property name in method code, but what about the issue of the property name/ value that I have set on each form SCX?
Jim Nelson
Newbury Park, CA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform