Subject Re: & and class::
From Michel <mgomet@gmail.com > <Michel <mgomet@gmail.com >>
Date Fri, 05 Nov 2021 10:00:07 -0400
Newsgroups dbase.getting-started

many thanks for explanations Andy; well undestood. it runs perfectly now

what I try to do is to use the same sequence on different pushbuttons onClick event

myPushbutton1_onClick = {;class(MYPROC(variable1, variable2)

myPushbutton2_onClick = {;class(MYPROC(variable3, variable4)

Procedure MYPROC(m1, m2)
//deal with m1

Cmd = "form." + m2 + "()"
&Cmd

regards,

Michel

Andy Taylor Wrote:

> Michel,
>
> The class:: designation requires some context in which to work.
> Your macro evaluates as the command:
>    class::test()
> So, you need to think about what "class" means to dBASE when you run your macro.
>
> The OLH for the "Scope resolution operator" says that CLASS and SUPER may be used only inside a class definition.
> CLASS refers to the class being defined and SUPER refers to the base class of the current class, if any.
> So both Class and Super need the context of being run as part of the instantion code for a particular class.
>
> If your test function exists in the form then the usual call would be form.test() if the form is the active form.
> If the form is named "MyForm" then an alternative call might be MyForm::test() if you want to use the "::" operator.
>
> You don't give us enough info in your post to say how & when you call the MYPROC method.
> Please let us know a bit more about what you are trying to achieve.
>
> Regards,
> Andy
>
> Incidentally you pass a variable reference called test to your procedure and also use a form.method called test.
> I try to avoid having variable names the same name as a form method as it saves confusion (either for me or dBASE)....    
>
> > Hello,
> >
> > trying to run the code below I receive this error message : "Not member of Class or Base class:  test"
> >
> > Procedure MYPROC(test)
> > Cmd = "class::" + test + "()"
> > &Cmd
> > return
> >
> > the function test is really existing in the form.
> >
> > thanks for help
> > Michel
> >
> >
>