Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Threaded Procedure Call Definition - How do I use to pass parameters? 2

Status
Not open for further replies.

rleiman

Programmer
May 3, 2006
258
US
Hi Everyone,

I noticed on the procedure properties of the forms, browses, etc. a section called "Threaded Procedure Call Definition".

Can you tell me how to go about setting up parameters that I can pass to my procedures? For example: Sending a string to the called procedure. Can you also tell me what embeds to use as well since this will be my first attempt at doing this?

Can you tell me if setting up user defined events is better than passing parameters to procedures? If this is true, can you tell me how to set it up?

I hope I am not asking to many questions for a single post.

I looked at the help, but it did not give any tutorials on doing parameters or user defined event processing.

Thanks
Emad
 
Hi Emad,

I have not used this option so I need to check it first.

Regards
 
Hi ShankarJ,

Thanks for checking how it works.

Truly,
Emad
 
Hi Emad,

Where do you see this :

"Threaded Procedure Call Definition"

I cannot see it here and I am using C6.3.9055 EE. Maybe it is a third party extension.

Regards
 
Hi ShankarJ,

I tried to find it again but could not find it. If I find it I will let you know. It was deeply nested withing some dialogs.

On each procedure properties of the browses, forms, etc. there is a similar field called "Procedure Parameters". I also saw this one on a browse procedure's main properties screen.

Truly,
Emad
 
Hi Emad,

It is asked when you define a button and set the Action to call a Procedure. This is nothing but asking if any parameters needs to be sent to the called procedure. To compile correctly you need the called procedure to have a prototype and parameter setup. If you set it to Initiate Thread than the parameters must be passed by value, must be Strings and cannot exceed three. If you need to pass more define a GROUP and pass the group since Groups are treated as strings only. If you are not initiating a new thread, you can pass any number of parameters by value or address. Read the help on Parameter passing.

Regards
 
Hi Emad,

I guess I did not answer your question fully. Let us say that you are calling ProcA with a STRING and BYTE parameter passed by value. So, on the window properties of ProcA, you would set the prototype and parameters field as (STRING StringParam, BYTE ByteParam). On the button in procedure ProcB, you would set the parameter list as ('xyz', 1) or use variables (SentString, SentByte).

Regards
 
Hi ShankarJ,

Thanks for the help.

I will try it when I want to pass some values to another procedure.

It is good to know how to do it.

Truly,
Emad
 
When starting a new thread, the START() command is used.
As Shankar pointed out you may have 0,1,2 or 3 parameters all of which must be string value parameters. At first glance this appears to be limiting in the sorts of things that you can do, but due to Clarions auto type conversion it's not that bad. All value paramaters can be passed a strings. Also as Shankar pointed out you can pass a group.

Now, when you want to pass something by address, then you need to be a little more creative, but it's still pretty straight forward. What you do is pass the ADDRESS() as a value string and then use a reference

This is how to code a procedure that you want to START on a new thread, and you need to pass something by Address.
Code:
!want a START()able procedure that is conceptually like:
!MyProc PROCEDURE(*ctMyClass xaMyClass)

MyProc PROCEDURE(STRING xAddressOfMyClass)
xaMyClass &ctMyClass
  CODE
  xaMyClass &= xAddressOfMyClass + 0

  !the TRICK here is to make an EXPRESSION on the 
  !  right hand side of the &= 

  !many people prefer using parenthesis, such as
  !  xaMyClass &= (xAddressOfMyClass)

So when using this technique, what will you START() call look like?
Code:
START(MyProc,,AnInstanceOfMyClass) !<-- bad
Code:
START(MyProc,,ADDRESS(AnInstanceOfMyClass)&'') !<-- good
!the   &''    isn't really necessary, but it makes it a little clearer that we're passing a STRING.

HTH,
Mark Goldberg

 
Hi Mark,

Thanks for the lesson.

Can all these be set up from using the entry fields in the "Procedure Properties" screen?

I ask this because I have not hand coded an entire app yet even though I know many people who have done that.

Truly,
Emad
 
Hi Emah,

Yes, I think you should be able to do all of it via templates.

- Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top