1. How do you call a process

In one part of the program I wrote a procedure to read a record out of my
database.=0D
 =0D
procedure onClick_MenuGetRec(integer self, integer even, sequence parms)=
=0D
err =3D db_open("Eye-Comp",DB_LOCK_NO)=0D
err =3D db_select_table("Diagnosis")=0D
key =3D db_find_key(getText(Code))=0D
if key >0 then=0D
setText(Code,db_record_key(key))=0D
setText(Desc,db_record_data(key))=0D
else=0D
setText(Desc,"** Code Not Found ***")=0D
end if =0D
db_close()=0D
end procedure=0D
setHandler({ MenuGetRec, ToolGetRec}, w32HClick, routine_id(=20
onClick_MenuGetRec" ))=0D
 =0D
 In another part of the program I want to do the same thing. I tried to use=

call_proc(onClick_MenuGetRec,{}) but I get the following error:=0D
 =0D
Syntax error - expected to see an expression, not a procedure=0D
=0D
=0D
I know I need to put error trapping in the program.  I want to design a dia=
log box that can be used to report all errors, but I haven't got to it yet.=

new topic     » topic index » view message » categorize

2. Re: How do you call a process

>From: Ron Austin <ronaustin at alltel.net>
>Subject: How do you call a process
>
>
>In one part of the program I wrote a procedure to read a record out of my
>database.
>  procedure onClick_MenuGetRec(integer self, integer even, sequence parms)
>
>err = db_open("Eye-Comp",DB_LOCK_NO)
>err = db_select_table("Diagnosis")
>key = db_find_key(getText(Code))
>if key >0 then
>setText(Code,db_record_key(key))
>setText(Desc,db_record_data(key))
>else
>setText(Desc,"** Code Not Found ***")
>end if db_close()
>end procedure
>setHandler({ MenuGetRec, ToolGetRec}, w32HClick, 
>routine_id("onClick_MenuGetRec" ))
>   In another part of the program I want to do the same thing. I tried to 
>use
>
>call_proc(onClick_MenuGetRec,{}) but I get the following error:
>

You need to pass some parameters at least. onClick_MenuGetRec() takes three. 
Since you aren't using them, it probably doesn't matter what you use, so 
long as they fit the types.

>Syntax error - expected to see an expression, not a procedure
>

Maybe you have an extra = or something before this line.

>
>I know I need to put error trapping in the program.  I want to design a 
>dialog
>box that can be used to report all errors, but I haven't got to it yet.
>

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

3. Re: How do you call a process

----- Original Message ----- 
From: "Ron Austin" <ronaustin at alltel.net>
To: <EUforum at topica.com>
Subject: How do you call a process


> 
> 
> In one part of the program I wrote a procedure to read a record out of my
> database.=0D
>  =0D
> procedure onClick_MenuGetRec(integer self, integer even, sequence parms)=
> =0D
> err =3D db_open("Eye-Comp",DB_LOCK_NO)=0D
> err =3D db_select_table("Diagnosis")=0D
> key =3D db_find_key(getText(Code))=0D
> if key >0 then=0D
> setText(Code,db_record_key(key))=0D
> setText(Desc,db_record_data(key))=0D
> else=0D
> setText(Desc,"** Code Not Found ***")=0D
> end if =0D
> db_close()=0D
> end procedure=0D
> setHandler({ MenuGetRec, ToolGetRec}, w32HClick, routine_id(=20
> onClick_MenuGetRec" ))=0D
>  =0D
>  In another part of the program I want to do the same thing. I tried to use=
> 
> call_proc(onClick_MenuGetRec,{}) but I get the following error:=0D
>  =0D
> Syntax error - expected to see an expression, not a procedure=0D
> =0D
> =0D

The simplest way is to just call it as a normal Euphoria routine ...

  onClick_MenuGetRec()

Alternatively you can use win32lib to call it thus ....

  VOID = invokeHandler(MenuGetRec, w32HClick, {})

-- 
Derek

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

4. Re: How do you call a process

call_proc() and call_func() use id's provided by routine_id(), so to make it
work, you'd need this:

    atom myID
        myID = routine_id("onClick_MenuGetRec")
        call_proc( myID, { 0, 0, {}} )    -- self = 0, even = 0, parms = {}

or simply this:

    call_proc( routine_id("onClick_MenuGetRec"), {0, 0, {}} )

With Win32Lib, however, I recommend using invokeHandler() to call the event
handlers for your controls. call_proc() and call_func() are used internally
by invokeHandler(), and if anyone ever looks at your code, invokeHandler()
will give them a better understanding of what you're doing.

~Greg


----- Original Message -----
From: "Ron Austin" <ronaustin at alltel.net>
To: <EUforum at topica.com>
Sent: Saturday, October 18, 2003 10:00 PM
Subject: How do you call a process


>
>
> In one part of the program I wrote a procedure to read a record out of my
> database.=0D
>  =0D
> procedure onClick_MenuGetRec(integer self, integer even, sequence parms)=
> =0D
> err =3D db_open("Eye-Comp",DB_LOCK_NO)=0D
> err =3D db_select_table("Diagnosis")=0D
> key =3D db_find_key(getText(Code))=0D
> if key >0 then=0D
> setText(Code,db_record_key(key))=0D
> setText(Desc,db_record_data(key))=0D
> else=0D
> setText(Desc,"** Code Not Found ***")=0D
> end if =0D
> db_close()=0D
> end procedure=0D
> setHandler({ MenuGetRec, ToolGetRec}, w32HClick, routine_id(=20
> onClick_MenuGetRec" ))=0D
>  =0D
>  In another part of the program I want to do the same thing. I tried to
use=
>
> call_proc(onClick_MenuGetRec,{}) but I get the following error:=0D
>  =0D
> Syntax error - expected to see an expression, not a procedure=0D
> =0D
> =0D
> I know I need to put error trapping in the program.  I want to design a
dia=
> log box that can be used to report all errors, but I haven't got to it
yet.=
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

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

5. Re: How do you call a process

----- Original Message ----- 
From: "Derek Parnell" <ddparnell at bigpond.com>
To: <EUforum at topica.com>
Subject: Re: How do you call a process


> 
> 
> ----- Original Message ----- 
> From: "Ron Austin" <ronaustin at alltel.net>
> To: <EUforum at topica.com>
> Sent: Sunday, October 19, 2003 12:00 PM
> Subject: How do you call a process
> 
> 
> > In one part of the program I wrote a procedure to read a record out of my
> > database.=0D
> >  =0D
> > procedure onClick_MenuGetRec(integer self, integer even, sequence parms)=
> > =0D
> > err =3D db_open("Eye-Comp",DB_LOCK_NO)=0D
> > err =3D db_select_table("Diagnosis")=0D
> > key =3D db_find_key(getText(Code))=0D
> > if key >0 then=0D
> > setText(Code,db_record_key(key))=0D
> > setText(Desc,db_record_data(key))=0D
> > else=0D
> > setText(Desc,"** Code Not Found ***")=0D
> > end if =0D
> > db_close()=0D
> > end procedure=0D
> > setHandler({ MenuGetRec, ToolGetRec}, w32HClick, routine_id(=20
> > onClick_MenuGetRec" ))=0D
> >  =0D
> >  In another part of the program I want to do the same thing. I tried to use=
> > 
> > call_proc(onClick_MenuGetRec,{}) but I get the following error:=0D
> >  =0D
> > Syntax error - expected to see an expression, not a procedure=0D
> > =0D
> > =0D
> 
> The simplest way is to just call it as a normal Euphoria routine ...
> 
>   onClick_MenuGetRec()

Ooops. That should be more like ...

    onClick_MenuGetRec(MenuGetRec, w32HClick, "")

 
> Alternatively you can use win32lib to call it thus ....
> 
>   VOID = invokeHandler(MenuGetRec, w32HClick, {})
> 
> -- 
> Derek
> 
> 
> 
> 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