Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can call a function from DEFINE class?
Message
 
 
To
06/05/2024 00:15:13
Lutz Scheffler (Online)
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01687987
Message ID:
01687990
Views:
39
Lutz,

Thank you very much for the detailed reply and help!

>>Hi,
>>
>>I would like to be sure that what I am doing is not possible. I am calling a function (using DO FunctionName) from the DEFINE CLASS statement. I get an error.
>>
>>Does it mean that I must have the function FunctionName as a Procedure in the CLASS?
>>
>>TIA
>
>Dmitry,
>
>A lot of stuff.
>
>First. This (see help DEFINE CLASS Command)
>
>DEFINE CLASS ClassName1 AS ParentClass
> PROCEDURE cName
>  ENDPROC
>ENDDEFINE
>
>Declares a Method cName of Class ClassNHame1. Even if it shares the PROCEDURE keyword and some syntax, it is not to be mixed with a function or procedure. There is a lot of difference.
>
>A (User Defined) Function could be called from anywhere, as long as it is to be found. For VFP, there is not much difference declaring a procedure vs. declaring a function.
>The declaration of FUNCTION or PROCEDURE does not determine how to use. Only the call (as below) determines the use. For short User Defined Function or Procedure are named UDF.
>
>
DO BlyBla
is not a function call. It's a call for a prg or a procedure. A function is called like
BlaBla()
. A function will have a return value, a procedure not.
>There are also differences if parameters are by value or by reference. See help for function calls and DO command.
>
>Both functions and procedures are stored in PRG files. A prg file in itself could be a procedure like unit called a program.
>
>Now calling an UDF needs the UDF to be found. Normally the UDF must be within the app or exe, or set visible using SET PROCEURE TO (see help), or if called like
>
DO MYPROG.prg
, within the same prg file.
>
>HTH
>Lutz
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform