Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Same instance of a class object in multiple forms
Message
From
12/10/2001 04:02:49
 
 
To
11/10/2001 20:21:39
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00567344
Message ID:
00567439
Views:
12
Hi!

You require to make as many instances of class as you have forms. This is because there is a bug difference between objects containership and objects referencing. To display some object inside of the form, it should be contained in the form container. This is possible only when object is created as a child object in the form container, either by adding it in design time to form or by using AddObject/NewObject methods of the form - both initialize new instance of the object. You cannot reference object in another form and display it on that form. To display some object on that form it should be as chilid in the form's container.

However, you can do this by another, tricky way. VFP have ability to show form inside of the form. Take a look to the DEFINE WINDOW ... IN WINDOW ... NAME ... command. It will allow you to define a VFP window inside of your form and put a reference to that window into a variable. You can than use such window to show it in another VFP window by using SHOW WINDOW ... IN WINDOW ... This works well only for modeless forms (Modal forms do not allow to forward events to a child windows). In addition, you still able to show only one object - when you just show such window in another form, it is removed from previous parent form, no way to display that form in all forms at the same time. This trick works just on the level of parent/child windows relationships in the Windows system.

See if this can help you.

>Hi
>
>Is it possible to have the same instance of object (e.g. an outlook like menu) in multiple forms.
>
>How do I add the reference into the form. Initially I would generate the menu based on the users login clearances but once generated want it to appear in multiple forms at the same time. (Perhaps not a good idea but the princple is what I a interested in -> i.e can I have a system box in all windows)
>
>regards
>a very hopeful novice
>Geoff Scott
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Reply
Map
View

Click here to load this message in the networking platform