Radio Button problem

This forum is for eXpress++ general support.
Post Reply
Message
Author
Andy Edward
Posts: 103
Joined: Fri Sep 17, 2010 2:58 am

Radio Button problem

#1 Post by Andy Edward »

Hi,

I'm having a weird problem with radio buttons in my development machine. When I clicked the radio button, the other radio buttons will be de-selected and the program will hang.

Initial screen
Untitled-2.png
Untitled-2.png (45.33 KiB) Viewed 11130 times
After selection
Untitled-3.png
Untitled-3.png (43.75 KiB) Viewed 11130 times
If I put the program in another PC, and run the program from my PC (So I'm running the program using a mapped network drive), I don't see the issue. Everything works just fine.

So it seems like locally (in my dev machine) the radio button will have problems. I have a feeling, that it is unable to re-draw.

Anyone have encountered this issue in their dev machine?

My development environment is Windows 7 32 bit, 2 GB RAM, Express++2.6, xBase 1.9.331

Best Regards,

Andy

User avatar
Tom
Posts: 1172
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Radio Button problem

#2 Post by Tom »

Looks like you missed to put a group around every radio button pair. Place an empty DCSAY behind them and select this as the parent for the radiobuttons. Radio buttons need a group parent to act correct. Show your code.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
sdenjupol148
Posts: 151
Joined: Thu Jan 28, 2010 10:27 am
Location: NYC

Re: Radio Button problem

#3 Post by sdenjupol148 »

Hey Andy,

I usually place each radio button set on its own static, so in your case, I would have stacked 10 statics on top of each other.
Tom is right, each set needs its own parent.

Bobby

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Radio Button problem

#4 Post by rdonnay »

I have been meaning to provide the means to group radiobuttons by a GROUP name rather than parent.
The eXpress train is coming - and it has more cars.

Andy Edward
Posts: 103
Joined: Fri Sep 17, 2010 2:58 am

Re: Radio Button problem

#5 Post by Andy Edward »

Tom wrote:Looks like you missed to put a group around every radio button pair. Place an empty DCSAY behind them and select this as the parent for the radiobuttons. Radio buttons need a group parent to act correct. Show your code.
SbDrakos wrote:Hey Andy,

I usually place each radio button set on its own static, so in your case, I would have stacked 10 statics on top of each other.
Tom is right, each set needs its own parent.

Bobby
Yes, my radio button sets doesn't have any parent object.

My Code

Code: Select all

@RC1,99     DCRADIO lYESNO PROMPT 'Yes' VALUE .T.;
              EVAL {|o|o:KEYBOARD:=NIL};
              ACTION {|o| o:=DBC_FILE(XF),DC_GETREFRESH(GETLIST)};
              COLOR M_RADIO_CLR TABGROUP XBP_BEGIN_GROUP
  
@RC1,109    DCRADIO lYESNO PROMPT 'No' VALUE .F.;
              EVAL {|o|o:KEYBOARD:=NIL};
              ACTION {|o| o:=FERASE(XF),DC_GETREFRESH(GETLIST)};
              COLOR M_RADIO_CLR TABGROUP XBP_END_GROUP
I've tried this, but the radio buttons disappear

Code: Select all

  cObject = 'o' + var2char(RC1) 
  @RC1,99     DCSAY ''  OBJECT &cObject SAYSIZE 10,1 && TO BE THE PARENT
  @RC1,99     DCRADIO lYESNO PROMPT 'Yes' VALUE .T.;
              EVAL {|o|o:KEYBOARD:=NIL};
              ACTION {|o| o:=DBC_FILE(XF),DC_GETREFRESH(GETLIST)};
              PARENT &cObject COLOR M_RADIO_CLR TABGROUP XBP_BEGIN_GROUP
  
  @RC1,109    DCRADIO lYESNO PROMPT 'No' VALUE .F.;
              EVAL {|o|o:KEYBOARD:=NIL};
              ACTION {|o| o:=FERASE(XF),DC_GETREFRESH(GETLIST)};
              PARENT &cObject COLOR M_RADIO_CLR TABGROUP XBP_END_GROUP
I must be missing something. :think: but I can't figure it out. Any ideas?

Andy

User avatar
sdenjupol148
Posts: 151
Joined: Thu Jan 28, 2010 10:27 am
Location: NYC

Re: Radio Button problem

#6 Post by sdenjupol148 »

Hey Andy,

This is a matter of how objects layer on top of each other.
I took your code and modified it somewhat to show you how things get positioned.

I colored your DCSAY PARENT object in yellow so you can see where the radio buttons wind up in relation to it.
The parent should be slightly larger vertically and horizontally than the objects you're going to place on it.
I made it extra large for demonstration purposes.

Notice that you will need a row position smaller than 1 to get it near the top of your parent object
Anyway, play around with different values till you get the effect you want.


*----------------------------------
#INCLUDE "DCDIALOG.CH"

proc main

LOCAL GetList[0]
LOCAL cObject, lYesNo := .F., RC1

RC1 := 1
cObject = 'o' + var2char(RC1)
@RC1,1 DCSAY '' OBJECT cObject SAYSIZE 20,2 COLOR GRA_CLR_BLACK, GRA_CLR_YELLOW// TO BE THE PARENT

@RC1,1 DCRADIO lYESNO PROMPT 'Yes' VALUE .T.;
EVAL {|o|o:KEYBOARD:=NIL};
ACTION {|o| /*o:=DBC_FILE(XF),*/DC_GETREFRESH(GETLIST)};
PARENT cObject TABGROUP XBP_BEGIN_GROUP

@RC1-1,10 DCRADIO lYESNO PROMPT 'No' VALUE .F.;
EVAL {|o|o:KEYBOARD:=NIL};
ACTION {|o| /*o:=FERASE(XF),*/DC_GETREFRESH(GETLIST)};
PARENT cObject TABGROUP XBP_END_GROUP

DCREAD GUI ADDBUTTONS FIT ENTEREXIT MODAL SETAPPWINDOW EVAL {|| (WTF cObject)}

return

*--------------------------------------
procedure appsys; return

Andy Edward
Posts: 103
Joined: Fri Sep 17, 2010 2:58 am

Re: Radio Button problem

#7 Post by Andy Edward »

SbDrakos wrote:Hey Andy,

This is a matter of how objects layer on top of each other.
I took your code and modified it somewhat to show you how things get positioned.
I've tried your code and it's not working at my end

Does a different approach is needed, if I'm trying to do the radio buttons in tabs? I didn't mention that at first because I didn't thought it was relevant.

My code:

Code: Select all

@0,0 DCTABPAGE oTabPage1 CAPTION 'General' SIZE 125,25 TABWIDTH 12 TOOLTIP 'Genaral feature' COLOR COL_HK1,COL_HK2 PARENT ABC

   DCSETPARENT to oTabPage1
   @0.0,0 DCTABPAGE oTabPage1A CAPTION 'General Page 1' SIZE 125,25 TABWIDTH 15 RELATIVE oTABPAGE1
   @0,0   DCTABPAGE oTabPage1B CAPTION 'General Page 2' RELATIVE oTABPAGE1A
   @0,0   DCTABPAGE oTabPage1C CAPTION 'General Page 3' RELATIVE oTABPAGE1B
   @0,0   DCTABPAGE oTabPage1D CAPTION 'General Page 4' RELATIVE oTABPAGE1C

   DCSETPARENT to oTabPage1A

   RC1++
   lSHORTCUT1:=.T.
   @RC1+.2,5  DCSAY {|| xTEXT('To activate Shortcut Toolbar for Internet Access')}  FONT cSAYFONT SAYSIZE 0 PARENT oTabPage1A
   
   @RC1,99    DCSAY '' OBJECT andy SAYSIZE 20,2 PARENT oTabPage1A COLOR GRA_CLR_BLACK, GRA_CLR_YELLOW// TO BE THE PARENT
   @RC1,99    DCRADIO lSHORTCUT1 PROMPT 'Yes' VALUE .T.;
              EVAL {|o|o:KEYBOARD:=NIL};
              ACTION {|| DBC_FILE('\INFOWIN\SHORTCUT.DB'),DC_GETREFRESH(GETLIST)};
              COLOR M_RADIO_CLR PARENT andy TABGROUP XBP_BEGIN_GROUP 

   @RC1,109   DCRADIO lSHORTCUT1 PROMPT 'No' VALUE .F.;
              EVAL {|o|o:KEYBOARD:=NIL};
              ACTION {|| FERASE('\INFOWIN\SHORTCUT.DB'),DC_GETREFRESH(GETLIST)};
              COLOR M_RADIO_CLR PARENT andy TABGROUP XBP_END_GROUP 

   RC1++
   IF FILE('C:\INFOWIN\SHORTCUT.DB')  && 20070316  && local PC setting
      lSHORTCUT2:=.T.
   ELSE
      lSHORTCUT2:=.F.
   ENDIF
   @RC1+.2,5  DCSAY {|| xTEXT('To activate Shortcut Toolbar for Local PC Access')}  FONT cSAYFONT SAYSIZE 0 OBJECT oTabPage1A
   @RC1,99    DCRADIO lSHORTCUT2 PROMPT 'Yes' VALUE .T.;
              EVAL {|o|o:KEYBOARD:=NIL};
              ACTION {|| DBC_FILE('C:\INFOWIN\SHORTCUT.DB'),DC_GETREFRESH(GETLIST)};
              COLOR M_RADIO_CLR TABGROUP XBP_BEGIN_GROUP OBJECT oTabPage1A

   @RC1,109   DCRADIO lSHORTCUT2 PROMPT 'No' VALUE .F.;
              EVAL {|o|o:KEYBOARD:=NIL};
              ACTION {|| FERASE('C:\INFOWIN\SHORTCUT.DB'),DC_GETREFRESH(GETLIST)};
              COLOR M_RADIO_CLR TABGROUP XBP_END_GROUP OBJECT oTabPage1A


DCSETPARENT to oTabPage1B
DCSETPARENT to oTabPage1C
DCSETPARENT to oTabPage1D
DCSETPARENT
.
.
.
code snipped for brevity
Result:
Untitled-1.gif
Untitled-1.gif (11.46 KiB) Viewed 11008 times
Best Regards,

Andy

User avatar
sdenjupol148
Posts: 151
Joined: Thu Jan 28, 2010 10:27 am
Location: NYC

Re: Radio Button problem

#8 Post by sdenjupol148 »

Hey Andy,

Using your supplied code snippet, I had to default a few of your #DEFINES to make it work.
Compare it with your code snippet.
Remember that each radio button group needs its own PARENT.
Notice that I added an extra DCSAY "" for the 2nd radio button group.

Code: Select all

#INCLUDE "DCDIALOG.CH"
proc main

   #DEFINE COL_HK1      GRA_CLR_GREY
   #DEFINE COL_HK2      GRA_CLR_YELLOW
   #DEFINE M_RADIO_CLR  GRA_CLR_BLUE

   LOCAL GetList[0], GetOptions
   LOCAL oTabPage1, oTabPage1A, oTabPage1B, oTabPage1C, oTabPage1D, ABC, oRadio1, oRadio2
   LOCAL Rc1, cSayFont, cObject
   LOCAL lShortcut1, lShortcut2

   DEFAULT RC1 := 1



   @ 0,0 DCTABPAGE oTabPage1 CAPTION 'General' SIZE 125,25 TABWIDTH 12 TOOLTIP 'Genaral feature' /*COLOR COL_HK1,COL_HK2*/ PARENT ABC

   DCSETPARENT to oTabPage1
   @ 0.0,0 DCTABPAGE oTabPage1A CAPTION 'General Page 1' SIZE 125,25 TABWIDTH 15 RELATIVE oTABPAGE1
   @ 0,0   DCTABPAGE oTabPage1B CAPTION 'General Page 2' RELATIVE oTABPAGE1A
   @ 0,0   DCTABPAGE oTabPage1C CAPTION 'General Page 3' RELATIVE oTABPAGE1B
   @ 0,0   DCTABPAGE oTabPage1D CAPTION 'General Page 4' RELATIVE oTABPAGE1C

   DCSETPARENT to oTabPage1A

   RC1++
   lSHORTCUT1:=.T.
   @RC1, 5    DCSAY {|| 'To activate Shortcut Toolbar for Internet Access'}  FONT cSAYFONT SAYSIZE 0 PARENT oTabPage1A

   @RC1,99    DCSAY '' OBJECT oRadio1 SAYSIZE 16,1.1 PARENT oTabPage1A COLOR GRA_CLR_BLACK, GRA_CLR_YELLOW// TO BE THE PARENT
   @  0, 1    DCRADIO lSHORTCUT1 PROMPT 'Yes' VALUE .T.;
              EVAL {|o|o:KEYBOARD:=NIL};
              ACTION {|| DBC_FILE('\INFOWIN\SHORTCUT.DB'),DC_GETREFRESH(GETLIST)};
              COLOR M_RADIO_CLR PARENT oRadio1 TABGROUP XBP_BEGIN_GROUP

   @  0,10    DCRADIO lSHORTCUT1 PROMPT 'No' VALUE .F.;
              EVAL {|o|o:KEYBOARD:=NIL};
              ACTION {|| FERASE('\INFOWIN\SHORTCUT.DB'),DC_GETREFRESH(GETLIST)};
              COLOR M_RADIO_CLR PARENT oRadio1 TABGROUP XBP_END_GROUP

   RC1++
   IF FILE('C:\INFOWIN\SHORTCUT.DB')  && 20070316  && local PC setting
      lSHORTCUT2:=.T.
   ELSE
      lSHORTCUT2:=.F.
   ENDIF
   @RC1, 5    DCSAY {|| 'To activate Shortcut Toolbar for Local PC Access'}  FONT cSAYFONT SAYSIZE 0 PARENT oTabPage1A

   @RC1,99    DCSAY '' OBJECT oRadio2 SAYSIZE 16,1.1 PARENT oTabPage1A COLOR GRA_CLR_BLACK, GRA_CLR_GREEN// TO BE THE PARENT
   @  0, 1    DCRADIO lSHORTCUT2 PROMPT 'Yes' VALUE .T.;
              EVAL {|o|o:KEYBOARD:=NIL};
              ACTION {|| DBC_FILE('C:\INFOWIN\SHORTCUT.DB'),DC_GETREFRESH(GETLIST)};
              COLOR M_RADIO_CLR PARENT oRadio2 TABGROUP XBP_BEGIN_GROUP OBJECT oTabPage1A

   @  0,10    DCRADIO lSHORTCUT2 PROMPT 'No' VALUE .F.;
              EVAL {|o|o:KEYBOARD:=NIL};
              ACTION {|| FERASE('C:\INFOWIN\SHORTCUT.DB'),DC_GETREFRESH(GETLIST)};
              COLOR M_RADIO_CLR PARENT oRadio2 TABGROUP XBP_END_GROUP OBJECT oTabPage1A


   DCREAD GUI OPTIONS GetOptions ADDBUTTONS FIT ENTEREXIT MODAL SETAPPWINDOW

return


*--------------------------------------
function Dbc_File
return nil

*--------------------------------------
procedure appsys; return
Result:
qrid.jpg
qrid.jpg (40.53 KiB) Viewed 10974 times

Andy Edward
Posts: 103
Joined: Fri Sep 17, 2010 2:58 am

Re: Radio Button problem

#9 Post by Andy Edward »

Hi SbDrakos,

Everything is working now, thank you for the help. :dance:

I just want to add something, actually I had another problem after using parents for the radio buttons.

Whenever the second tab have an element, the problem persists. Apparently I need to remove DC_GETREFRESH(GETLIST) in all my radio button's action. It might be just me and my code, but just in case someone else encounter the same issue.

But all is well now. Thanks again.

Best Regards,

Andy

Post Reply