Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Greg Green
  Where is Greg Green?
 
 Georgia - United States
 Greg Green
 To: Dan Baker
  Where is Dan Baker?
 Effort of the Poconos
 Pennsylvania - United States
 Dan Baker
 Tags
Subject: RE: Can an Option Group have Number Options?
Thread ID: 365373 Message ID: 365535 # Views: 49 # Ratings: 0
Version: Visual FoxPro 9 Category: Forms
Date: Thursday, December 27, 2012 8:13:21 PM         
   


> >
> > The optionbutton group will always have a value of 1,2,3,etc. But you could use the Access method and have it return whatever value you want.
>
> Thanks, Greg.  
>
> I am familiar with Access and Assign for form properties, but I am not familiar with using an Assign property for the property of an individual control.
>
> I assume you add an Access method only to a subclassed control.   Am I limited to writing that code in a PRG file?   Or is there some way to add through method through the VFP IDE?
>
> Dan Baker

As Stefan noted, define a custom class of the optiongroup. Now in open the Edit Properties (you can use PEME here) and select the Value property for the optiongroup class. Now select the checkbox "Access" and save. This will add a new method to the optiongroup called value_access.

Add this to the code to return a zero based index:

RETURN this.Value-1


For a list of values you might add the following code:

DO CASE
CASE this.Value = 1
   RETURN "Left"
CASE this.Value = 2
   RETURN "Right"
CASE this.Value = 3
   RETURN "Center"
ENDCASE


ENTIRE THREAD

Can an Option Group have Number Options? Posted by Dan Baker @ 12/25/2012 2:46:45 PM
RE: Can an Option Group have Number Options? Posted by David Mustakim @ 12/25/2012 4:40:24 PM
RE: Can an Option Group have Number Options? Posted by Anders Altberg @ 12/25/2012 5:46:34 PM
RE: Can an Option Group have Number Options? Posted by Greg Green @ 12/25/2012 6:16:55 PM
RE: Can an Option Group have Number Options? Posted by Dan Baker @ 12/26/2012 2:27:04 PM
RE: Can an Option Group have Number Options? Posted by Stefan Wuebbe @ 12/26/2012 3:24:46 PM
RE: Can an Option Group have Number Options? Posted by Greg Green @ 12/27/2012 8:13:21 PM
RE: Can an Option Group have Number Options? Posted by Dan Baker @ 12/31/2012 4:36:58 PM
RE: Can an Option Group have Number Options? Posted by David Mustakim @ 1/1/2013 7:24:53 PM
RE: Can an Option Group have Number Options? Posted by Rick Hodgin @ 1/1/2013 7:51:35 PM
RE: Can an Option Group have Number Options? Posted by Dan Baker @ 1/1/2013 8:35:31 PM
RE: Can an Option Group have Number Options? Posted by Dan Baker @ 1/1/2013 8:40:39 PM
RE: Can an Option Group have Number Options? Posted by David Mustakim @ 1/1/2013 9:13:40 PM
RE: Can an Option Group have Number Options? Posted by Dan Baker @ 1/2/2013 1:07:38 AM
RE: Can an Option Group have Number Options? Posted by Stefan Wuebbe @ 1/2/2013 9:39:57 AM
RE: Can an Option Group have Number Options? Posted by Dan Baker @ 1/2/2013 12:17:12 PM
RE: Can an Option Group have Number Options? Posted by Stefan Wuebbe @ 1/2/2013 12:22:09 PM
RE: Can an Option Group have Number Options? Posted by Jun Tangunan @ 12/26/2012 12:16:41 AM