Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling a parent method from a child object problem...
Message
 
To
07/12/1998 14:15:27
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00164881
Message ID:
00165099
Views:
13
Salut Pascal,

To solve your problem of making the child form visible to a method called from a parent, you can pass the handle of the child to the parent's method. It would work something like this:

1. In the parent method, the first line will be:
LPARAMETERS toChildForm

IF TYPE('toChildForm') = "O" AND !ISNULL(toChildForm)
* --- code to process the child
* example:
toChildForm.Caption = "I can change the child window caption!"
...
...
ELSE
* --- code to process the parent itself if no parameter was passed.
...
...
ENDIF

2. In the child form, you will need to call the parent method with THISFORM as a parameter:
THISFORMSET.Forms(x).YourMethod(THISFORM)

Of course, the exact syntax will depend on how you are calling the form.

Hope this helps,
Rishabh.

>Hi All,
>
>I am putting in place multi-linguale functionality to an existing
>application. I created two recursive methods (SaveCaptions and
>SetCaptions) that are used to save and set the captions of a container and its sub-objetcs.
>
>These methods work fine when added to a form.
>
>Here is the problem:
>
>I am trying to call these methods from a child form but the methods being in the parent form, they cannot see the child form and its contained objects (I hope I am making sense...)
>
>Is there a way to make the child objects visible to the parent?
>Or a way to make these methods visible throughout the application?
>
>I cannot profit from inheritance since my application forms were based on the standard form class and not on a user-defined class (unless there is a way to change the baseclass of a form?)
>
>Anybody can help?
>
>Thanks in advance.
>
>P.Charbonneau
---
Rishabh Bakshi
Swarthmore, PA 19078
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform