On Mon, 2012-03-19 at 22:42 +1030, GMail wrote: > On Mon, 2012-03-19 at 11:43 +0100, Karl Reinl wrote: > > Salut, > > > > my question is for gambas2 and later for gambas3 > > > > I have an app, which uses gambas (home made) components. > > > > What does these components know about the app. > > > > What I'm looking for is, how can I call a Function in the app, > > out from the component, to report what has be done. > > > > If I try 'Form.Function()', I get 'unknown Symbol' error > > > > I know I can use the disk for passing something backwards, but I would > > first ask if there is a way. > Karl, > I don't know whether this will help in your case but there is a way to > do this ... for examples where the component class is inherited by an > application class. > > Due to the virtual dispatch used by gambas, the actual method called > will be the inherited method. > > So (for general readers) if you consider a component containing a base > class "Fred" that is inherited by a class in the main application, say > "SonOfFred", then when some "local" call in Fred, for example > Fred.Describe, if this method is also provided in SonOfFred then the > actual method, SonOfFred.Describe is invoked. > > But in this case, there is a trick needed in gambas 3. You need to > provide a "stub" method in the base class, to stop the IDE/compiler > complaining. Let me expand. If SonOfFred has a method "Decode" that you > wish to be able to be called (or in fact, invoked by the base class in > some way,) then you need to create a stub method in Fred. I see this as > the base class defining a method that must be overridden, IOW a sort of > virtual method. Mainly I implement the stub to raise an error if it is > invoked, i.e. in Fred we have: > > Public Sub Decode() > Error.Raise("Decode not overridden correctly") > End > > In your case though (assuming that by "Form" you mean the native gambas > "Form" class), this will not work. The only quick answer I can think of > is to use an event in the component that is going to (hopefully) be > handled adequately in the application. Bit of a lottery though. > > Or perhaps I haven't quite got your central issue here? > > Bruce > On rereading what I just said, I think I wrote a "when you have a hammer, everything looks like a nail" answer.
Send more details on what your problem/goal is. B ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user