Radio Button Help

Radio Button Help

Postby Jeff Barnes » Fri Mar 20, 2009 1:41 am

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  Expand view
     @ 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 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Radio Button Help

Postby Enrico Maria Giordano » Fri Mar 20, 2009 8:30 am

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Radio Button Help

Postby Jeff Barnes » Fri Mar 20, 2009 12:09 pm

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  Expand view
#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 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Radio Button Help

Postby Enrico Maria Giordano » Fri Mar 20, 2009 12:32 pm

A workaround (tested with FWH): put

Code: Select all  Expand view
oRad:aItems[ nDevice ]:Check()


just before ACTIVATE DIALOG command.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Radio Button Help

Postby Jeff Barnes » Fri Mar 20, 2009 2:34 pm

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

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 8 guests