1. How do I re-use a procedure?

Seems like today is the day for my procedures not to work.	I have a 
procedure (shown below) which I use to populate a listview control.  It 
works great.

procedure Print_to_Screen( integer self, integer even, sequence parms)
-- some code
end procedure
setHandler(MenuP_Scn, w32HClick, routine_id( "Print_to_Screen" ))


I want to use this procedure a second time in another part of my program 
so I inserted the code below 
as part of the second procedure.

Print_to_Screen (MenuP_Scn, w32HClick,"")

I get the error "Print_to_Screen" not declared".  What's wrong?  I have 
used this technique before 
without a problem, but I'm obviously missing something here.

new topic     » topic index » view message » categorize

2. Re: How do I re-use a procedure?

I'm guessing you're using the IDE here, but it doesn't really matter.

What has happened is that the place you are calling the procedure from is 
higher in the source code than the place it is declared. Euphoria only looks 
up for procedures, not further down. What I suggest you do to fix this is to 
replace the Print_to_Screen call with:

invokeHandler(MenuP_Scn, w32HClick)

This takes care of any code location issues, and is more robust, cause if 
you change the name "Print_to_Screen" to something else, you don't have to 
change the above call.

MrTrick


>From: Ron Austin <ronaustin at alltel.net>
>Reply-To: EUforum at topica.com
>To: EUforum at topica.com
>Subject: How do I re-use a procedure?
>Date: Tue, 25 Nov 2003 15:42:47 +0000
>
>
>Seems like today is the day for my procedures not to work.	I have a
>procedure (shown below) which I use to populate a listview control.  It
>works great.
>
>procedure Print_to_Screen( integer self, integer even, sequence parms)
>-- some code
>end procedure
>setHandler(MenuP_Scn, w32HClick, routine_id( "Print_to_Screen" ))
>
>
>I want to use this procedure a second time in another part of my program
>so I inserted the code below
>as part of the second procedure.
>
>Print_to_Screen (MenuP_Scn, w32HClick,"")
>
>I get the error "Print_to_Screen" not declared".  What's wrong?  I have
>used this technique before
>without a problem, but I'm obviously missing something here.
>
>
>
>TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: How do I re-use a procedure?

=0D
 =0D
-------Original Message-------=0D
 =0D
From: EUforum at topica.com=0D
Subject: Re: How do I re-use a procedure?=0D
 =0D
 =0D
  =0D
 =0D
>From: Ron Austin <ronaustin at alltel.net>=0D
>Reply-To: EUforum at topica.com=0D
>To: EUforum at topica.com=0D
>Subject: How do I re-use a procedure?=0D
>Date: Tue, 25 Nov 2003 15:42:47 +0000=0D
>=0D
>=0D
>Seems like today is the day for my procedures not to work. I have a=0D
>procedure (shown below) which I use to populate a listview control. It=0D
>works great.=0D
>=0D
>procedure Print_to_Screen( integer self, integer even, sequence parms)=0D
>-- some code=0D
>end procedure=0D
>setHandler(MenuP_Scn, w32HClick, routine_id( "Print_to_Screen" ))=0D
>=0D
>=0D
>I want to use this procedure a second time in another part of my program=
=0D
>so I inserted the code below=0D
>as part of the second procedure.=0D
>=0D
>Print_to_Screen (MenuP_Scn, w32HClick,"")=0D
>=0D
>I get the error "Print_to_Screen" not declared". What's wrong? I have=0D
>used this technique before=0D
>without a problem, but I'm obviously missing something here.=0D
=0D
>=3D=3D Mr Trick wrote =3D=3D=0D
I'm guessing you're using the IDE here, but it doesn't really matter.=0D
 =0D
What has happened is that the place you are calling the procedure from is =
=0D
higher in the source code than the place it is declared. Euphoria only look=
s
=0D
up for procedures, not further down. What I suggest you do to fix this is t=
o
=0D
replace the Print_to_Screen call with:=0D
 =0D
invokeHandler(MenuP_Scn, w32HClick)=0D
 =0D
This takes care of any code location issues, and is more robust, cause if =
=0D
you change the name "Print_to_Screen" to something else, you don't have to =
=0D
change the above call.=0D
 =0D
MrTrick=0D
>=0D
>=3D=3D Ron Replies =3D=3D=0D
Thank you for the tip about how Euphoria looks for procedures.  I reversed
the order of the procedures and now it works!=0D
=0D
When I tried to change it to invokeHandler(MenuP_Scn, w32HClick), however, =
I
got this message:=0D
syntax error - expected to see possibly 'end', not a function=0D
=0D
For a "simple" language, I am sure having a job getting it to work, but bit=

by bit with help from people like Euman, Derek, you and others, I am making=

progress.=0D
>TOPICA - Start your own email discussion group. FREE!=0D
>=0D
>=0D
 =0D
 =0D
=0D
Or send an email to: EUforum-unsubscribe at topica.com=0D
 =0D
TOPICA - Start your own email discussion group. FREE!=0D
 =0D
 =0D
 =0D
 =0D
.=20

new topic     » goto parent     » topic index » view message » categorize

4. Re: How do I re-use a procedure?

Oops, my mistake...

invokeHandler is actually a function, not a procedure.

VOID = invokeHandler(.........

should work a bit better.

------------------------------------------------------------------------
magnae clunes mihi placent, nec possum de hac re mentiri.


>From: Ron Austin <ronaustin at alltel.net>
>Reply-To: EUforum at topica.com
>To: EUforum at topica.com
>Subject: Re: How do I re-use a procedure?
>Date: Tue, 25 Nov 2003 13:26:56 -0500 (Easter
>
>
>  =0D
>  =0D
>-------Original Message-------=0D
>  =0D
>From: EUforum at topica.com=0D
>Date: Tuesday, November 25, 2003 12:05:50 PM=0D
>To: EUforum at topica.com=0D
>Subject: Re: How do I re-use a procedure?=0D
>  =0D
>  =0D
>   =0D
>  =0D
> >From: Ron Austin <ronaustin at alltel.net>=0D
> >Reply-To: EUforum at topica.com=0D
> >To: EUforum at topica.com=0D
> >Subject: How do I re-use a procedure?=0D
> >Date: Tue, 25 Nov 2003 15:42:47 +0000=0D
> >=0D
> >=0D
> >Seems like today is the day for my procedures not to work. I have a=0D
> >procedure (shown below) which I use to populate a listview control. It=0D
> >works great.=0D
> >=0D
> >procedure Print_to_Screen( integer self, integer even, sequence parms)=0D
> >-- some code=0D
> >end procedure=0D
> >setHandler(MenuP_Scn, w32HClick, routine_id( "Print_to_Screen" ))=0D
> >=0D
> >=0D
> >I want to use this procedure a second time in another part of my program=
>=0D
> >so I inserted the code below=0D
> >as part of the second procedure.=0D
> >=0D
> >Print_to_Screen (MenuP_Scn, w32HClick,"")=0D
> >=0D
> >I get the error "Print_to_Screen" not declared". What's wrong? I have=0D
> >used this technique before=0D
> >without a problem, but I'm obviously missing something here.=0D
>=0D
> >=3D=3D Mr Trick wrote =3D=3D=0D
>I'm guessing you're using the IDE here, but it doesn't really matter.=0D
>  =0D
>What has happened is that the place you are calling the procedure from is =
>=0D
>higher in the source code than the place it is declared. Euphoria only 
>look=
>s
>=0D
>up for procedures, not further down. What I suggest you do to fix this is 
>t=
>o
>=0D
>replace the Print_to_Screen call with:=0D
>  =0D
>invokeHandler(MenuP_Scn, w32HClick)=0D
>  =0D
>This takes care of any code location issues, and is more robust, cause if =
>=0D
>you change the name "Print_to_Screen" to something else, you don't have to 
>=
>=0D
>change the above call.=0D
>  =0D
>MrTrick=0D
> >=0D
> >=3D=3D Ron Replies =3D=3D=0D
>Thank you for the tip about how Euphoria looks for procedures.  I reversed
>the order of the procedures and now it works!=0D
>=0D
>When I tried to change it to invokeHandler(MenuP_Scn, w32HClick), however, 
>=
>I
>got this message:=0D
>syntax error - expected to see possibly 'end', not a function=0D
>=0D
>For a "simple" language, I am sure having a job getting it to work, but 
>bit=
>
>by bit with help from people like Euman, Derek, you and others, I am 
>making=
>
>progress.=0D
> >TOPICA - Start your own email discussion group. FREE!=0D
> >=0D
> >=0D
>  =0D
>  =0D
>=0D
>Or send an email to: EUforum-unsubscribe at topica.com=0D
>  =0D
>TOPICA - Start your own email discussion group. FREE!=0D
>  =0D
<snip>

>
>

new topic     » goto parent     » topic index » view message » categorize

5. Re: How do I re-use a procedure?

----- Original Message ----- 
From: "Ron Austin" <ronaustin at alltel.net>
To: <EUforum at topica.com>
Subject: Re: How do I re-use a procedure?


[snip]
> When I tried to change it to invokeHandler(MenuP_Scn, w32HClick), however, =
> I
> got this message:=0D
> syntax error - expected to see possibly 'end', not a function=0D
> =0D

This is because it was incorrectly given to you. It should read ...

    VOID  = invokeHandler(MenuP_Scn, w32HClick, {} )

and of course you will need to have ...

 object VOID 

defined near the top of your code somewhere.


-- 
Derek

new topic     » goto parent     » topic index » view message » categorize

6. Re: How do I re-use a procedure?

pssss..*whispers, "Hey, Ron"*  maybe that's because some things were
simplified so much that they don't function as well anymore?  *grins*  like
forward referencing functions?

MICHELLE ROGERS
----- Original Message -----
From: "Ron Austin" <ronaustin at alltel.net>
To: <EUforum at topica.com>
Subject: Re: How do I re-use a procedure?


>
>
>  =0D
>  =0D
> -------Original Message-------=0D
>  =0D
> From: EUforum at topica.com=0D
> Date: Tuesday, November 25, 2003 12:05:50 PM=0D
> To: EUforum at topica.com=0D
> Subject: Re: How do I re-use a procedure?=0D
>  =0D
>  =0D
>   =0D
>  =0D
> >From: Ron Austin <ronaustin at alltel.net>=0D
> >Reply-To: EUforum at topica.com=0D
> >To: EUforum at topica.com=0D
> >Subject: How do I re-use a procedure?=0D
> >Date: Tue, 25 Nov 2003 15:42:47 +0000=0D
> >=0D
> >=0D
> >Seems like today is the day for my procedures not to work. I have a=0D
> >procedure (shown below) which I use to populate a listview control. It=0D
> >works great.=0D
> >=0D
> >procedure Print_to_Screen( integer self, integer even, sequence parms)=0D
> >-- some code=0D
> >end procedure=0D
> >setHandler(MenuP_Scn, w32HClick, routine_id( "Print_to_Screen" ))=0D
> >=0D
> >=0D
> >I want to use this procedure a second time in another part of my program=
> =0D
> >so I inserted the code below=0D
> >as part of the second procedure.=0D
> >=0D
> >Print_to_Screen (MenuP_Scn, w32HClick,"")=0D
> >=0D
> >I get the error "Print_to_Screen" not declared". What's wrong? I have=0D
> >used this technique before=0D
> >without a problem, but I'm obviously missing something here.=0D
> =0D
> >=3D=3D Mr Trick wrote =3D=3D=0D
> I'm guessing you're using the IDE here, but it doesn't really matter.=0D
>  =0D
> What has happened is that the place you are calling the procedure from is
=
> =0D
> higher in the source code than the place it is declared. Euphoria only
look=
> s
> =0D
> up for procedures, not further down. What I suggest you do to fix this is
t=
> o
> =0D
> replace the Print_to_Screen call with:=0D
>  =0D
> invokeHandler(MenuP_Scn, w32HClick)=0D
>  =0D
> This takes care of any code location issues, and is more robust, cause if
=
> =0D
> you change the name "Print_to_Screen" to something else, you don't have to
=
> =0D
> change the above call.=0D
>  =0D
> MrTrick=0D
> >=0D
> >=3D=3D Ron Replies =3D=3D=0D
> Thank you for the tip about how Euphoria looks for procedures.  I reversed
> the order of the procedures and now it works!=0D
> =0D
> When I tried to change it to invokeHandler(MenuP_Scn, w32HClick), however,
=
> I
> got this message:=0D
> syntax error - expected to see possibly 'end', not a function=0D
> =0D
> For a "simple" language, I am sure having a job getting it to work, but
bit=
>
> by bit with help from people like Euman, Derek, you and others, I am
making=
>
> progress.=0D
> >TOPICA - Start your own email discussion group. FREE!=0D
> >=0D
> >=0D
>  =0D
>  =0D
> =0D
> Or send an email to: EUforum-unsubscribe at topica.com=0D
>  =0D
> TOPICA - Start your own email discussion group. FREE!=0D
>  =0D
>  =0D
>  =0D
>  =0D
> .=20
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu