How can I tell whether a method exists in an object?

I have a process that is passed a form as a variable and I want to run a
particular method if it exists on the form.

Running TYPE("MyForm.MyMethod") return "U" even if the method exists.

I could probably just instantiate the method and handle the erorr if it
doesnt exist but there must be a more elegant way?

Any ideas?

Cheers
David

Re: Does a method exist? by Stefan

Stefan
Wed Mar 23 02:01:52 CST 2005


"David Younger" <davidyounger1@hotmail.com> schrieb im Newsbeitrag
news:ut3IuW3LFHA.3844@TK2MSFTNGP14.phx.gbl...
> How can I tell whether a method exists in an object?
>
> I have a process that is passed a form as a variable and I want to run a
> particular method if it exists on the form.
>
> Running TYPE("MyForm.MyMethod") return "U" even if the method exists.
>
> I could probably just instantiate the method and handle the erorr if it
> doesnt exist but there must be a more elegant way?

You can use PemStatus()
oForm = CREATEOBJECT('Form')
? PEMSTATUS(oForm, 'Show', 5)
? PEMSTATUS(oForm, 'Unknown', 5)


hth
-Stefan



--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------


Re: Does a method exist? by Anders

Anders
Fri Mar 25 02:52:39 CST 2005

Use PEMSTATUS( )
-Anders

"David Younger" <davidyounger1@hotmail.com> wrote in message
news:ut3IuW3LFHA.3844@TK2MSFTNGP14.phx.gbl...
> How can I tell whether a method exists in an object?
>
> I have a process that is passed a form as a variable and I want to run a
> particular method if it exists on the form.
>
> Running TYPE("MyForm.MyMethod") return "U" even if the method exists.
>
> I could probably just instantiate the method and handle the erorr if it
> doesnt exist but there must be a more elegant way?
>
> Any ideas?
>
> Cheers
> David
>
>


Re: Does a method exist? by David

David
Sun Apr 10 22:33:20 CDT 2005

Excellent!!

Cheers
David


"Anders Altberg" <x_pragma@telia.com> wrote in message
news:OHtG2KSMFHA.2468@tk2msftngp13.phx.gbl...
> Use PEMSTATUS( )
> -Anders
>
> "David Younger" <davidyounger1@hotmail.com> wrote in message
> news:ut3IuW3LFHA.3844@TK2MSFTNGP14.phx.gbl...
> > How can I tell whether a method exists in an object?
> >
> > I have a process that is passed a form as a variable and I want to run a
> > particular method if it exists on the form.
> >
> > Running TYPE("MyForm.MyMethod") return "U" even if the method exists.
> >
> > I could probably just instantiate the method and handle the erorr if it
> > doesnt exist but there must be a more elegant way?
> >
> > Any ideas?
> >
> > Cheers
> > David
> >
> >
>