Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using/Adding container to a form
Message
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01505824
Message ID:
01505826
Views:
36
This message has been marked as a message which has helped to the initial question of the thread.
>Hi,
>
>I am adding a property FIELD_CONTAINER to a form, which works initially. But when I want to set a different class to the same property, I get error.
>
>Here is the snipet of the code:
>
>
>IF !TYPE( "thisform.field_container") = "O"
>    *-- Add this container to the form
>    thisform.newobject( "field_container", "myclass1", "myclasslib.vcx" )
>    *-- Works!	
>ELSE
>   *-- I want to use the same property (FIELD_CONTAINER but use a different class
>    thisform.field_container = NEWOBJECT("myclass2", "myclasslib.vcx" )	
>   *-- Error message:
>   *-- FIELD_CONTAINER is a method, event, or object
>ENDIF 
>
>
>What am I am missing? TIA

You either should use this.Property = newobject(...) -- but you can only do this for custom classes and they will not be "added to the form"

or

Remove the original container first and create a new container.

Use RemoveObject method first and then re-add the new container using the same name.

In other words, you will be re-using the same name for the new object (and not an object property).
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform