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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

radio buttons 2

Status
Not open for further replies.

Bhashi

Programmer
Sep 13, 2022
15
LK
I have a option group(3 radio buttons]) as below.
A
B
C

I want to call the method declared before when I select each option. As an example, when I choose option A, method A needs to be called. I want to write a Do Case for this scenario . How can I do this in FoxPro?
Thank you
 
First of all, an option group has the Interactivechange method to use for reacting to a user interaction. The value then already has changed to be the number of the active option button.

And then, from the VFP language, you have DO CASE as in:

Code:
Do case
   Case this.Value = 1
      * call method1
   Case this.Value = 2
      * call method2
   Case this.Value = 3
      * call method3
EndCase

Chriss
 
Chriss,
Thanks for the reply
How to call a method ?
If I provide only the method name is it fine ?
 
If I provide only the method name is it fine ?

No, you have to specify the object to which the method belongs. For example, if it is a method of the form, you would call it as [tt]THISFORM.Method1[/tt]. If it is a method of another form, you would call it as [tt]oForm.Method1[/tt] (where oForm is an object reference to the form.)

If the "method" is in fact a simple procedure or function, rather than an actual method, then you just need its name.

If the method is to return a value, you need to add parentheses, like this:[tt]x = oForm.Method1[highlight #FCE94F]()[/highlight][/tt]. You would also need parens if you are passing a parameter (just like when you call a function).

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thanks Mike for the immediate response
Helps a lot..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top