Radio Button Help

Post Reply
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Radio Button Help

Post by Jeff Barnes »

Hi Everybody,

I am trying to use Radio Buttons in my program settings to allow the user to select a device.
Everything seems to work as far as the correct number being returned but when I return to the settings screen the Radio Button will not show what the current selection is unless the current selection is the first option.

I have checked the stored value and it is fine (in this case it is 3)

In the code below I have 3 items. If anything other that the first item is selected, when you leave and return to the settings screen all 3 radios are empty (none selected) but again the value in my database is 3.

Note: when you are selecting the radio it will fill in the circle. The problem is when you leave and come back.

Code: Select all

      @ 0.65,1 say "Device:" SIZE 22,10
      @ 0.5,4 RADIO  oRad  VAR Config->Device SIZE 50,10 ITEMS "Nonin 9560" of oDlgCfg UPDATE COLOR RGB(0,0,0),RGB(230,225,172)        
      @ 1.0,4 RADIOITEM "Nonin 4100"       RADIOMENU oRad OF oDlgCfg SIZE 50, 10
        @ 1.5,4 RADIOITEM "Nonin 2500, 8500" RADIOMENU oRad OF oDlgCfg SIZE 70, 10
 
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Radio Button Help

Post by Enrico Maria Giordano »

Please take the time to build a reduced and self-contained sample of the problem.

EMG
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: Radio Button Help

Post by Jeff Barnes »

Here is the small sample.

I have defaulted nDevice to 3 so the last radio button should be selected but isn't :cry:

Code: Select all

#include "Fwce.ch"

Function ConfigGen()
   Local oDlgCfg, nDevice:=3, oRad

   DEFINE DIALOG oDlgCfg FROM 2,2 to 18,32 TITLE "Test" 
      @ 0.65,1 say "Device:" SIZE 22,10
      @ 0.5,4 RADIO  oRad  VAR nDevice SIZE 50,10 ITEMS "Item 1" of oDlgCfg 
      @ 1.0,4 RADIOITEM "Item 2" RADIOMENU oRad OF oDlgCfg SIZE 50, 10
        @ 1.5,4 RADIOITEM "Item 3" RADIOMENU oRad OF oDlgCfg SIZE 50, 10
      @ 5.5,7 BUTTON oBtn  PROMPT "OK"  SIZE 30,13 of oDlgCfg Action ( Msginfo("Item # "+str(nDevice)),oDlgCfg:End() )
   Activate Dialog oDlgCfg CENTER
Return Nil
 
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Radio Button Help

Post by Enrico Maria Giordano »

A workaround (tested with FWH): put

Code: Select all

oRad:aItems[ nDevice ]:Check()
just before ACTIVATE DIALOG command.

EMG
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: Radio Button Help

Post by Jeff Barnes »

Thanks Enrico. That solved the problem.
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
Post Reply