Page 1 of 1

Rad menu lost initial setting

PostPosted: Fri Oct 13, 2017 10:19 am
by AntoninoP
Hi,
In my program I see that a radio menu does not keep the initial value.
I did some try to solve it, without success...

here the code to reproduce the issue, prg:
Code: Select all  Expand view
#include <fivewin.ch>

proc main()
    LOCAL nTipGrp := 3, oDlg, oRadMenu, oFolder
   
    DEFINE DIALOG oDlg NAME "MAINDLG"
    REDEFINE FOLDER oFolder ID 4001  OF oDlg PROMPTS "Folder 1" DIALOGS "PAGE1"

    REDEFINE RADIO oRadMenu VAR nTipGrp ID 4001,4002,4003,4004,4005,4006,4045,4054,4055 OF oFolder:aDialogs[1]
    ACTIVATE DIALOG oDlg
    ? nTipGrp
return

and rc:
Code: Select all  Expand view
#include <windows.h>

MAINDLG DIALOGEX DISCARDABLE 6, 18, 614, 314
STYLE WS_POPUP|DS_MODALFRAME|DS_CONTEXTHELP|DS_3DLOOK|WS_CAPTION|WS_SYSMENU|WS_VISIBLE
CAPTION "Test Rad Menu"
FONT 8, "Segoe UI", 0, 0, 1
BEGIN
  CONTROL "", 4001, "SysTabControl32", WS_TABSTOP, 4, 4, 608, 284
  CONTROL "OK", IDOK, "Button", WS_TABSTOP, 4, 292, 45, 15
  CONTROL "CANCEL", IDCANCEL, "Button", WS_TABSTOP, 108, 292, 45, 15
END

PAGE1 DIALOGEX 6, 18, 614, 278
STYLE DS_SETFONT | WS_CHILD | WS_VISIBLE
FONT 8, "Segoe UI", 0, 0, 0x1
BEGIN
    CONTROL         "Opt 1",4001,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,12,8,64,8
    CONTROL         "Opt 2",4002,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,20,64,8
    CONTROL         "Opt 3",4003,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,32,64,8
    CONTROL         "Opt 4",4004,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,44,64,8
    CONTROL         "Opt 5",4005,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,80,8,68,8
    CONTROL         "Opt 6",4006,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,80,20,68,8
    CONTROL         "Opt 7",4045,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,80,32,68,8
    CONTROL         "Opt 8",4054,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,80,44,68,8
    CONTROL         "Opt 9",4055,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,148,8,76,8
END
 


The problem is the local nTipGrp that is initialized to 3 and become 1 before the dialog appears.

help :(
Antonino

Re: Rad menu lost initial setting

PostPosted: Tue Oct 17, 2017 9:04 am
by AntoninoP
has no one this issue too? a Rad Menu inside a folder...
:shock:

Re: Rad menu lost initial setting

PostPosted: Tue Oct 17, 2017 9:28 am
by Silvio.Falconi
on source code it run ok

Image

Code: Select all  Expand view
Function Test()
   LOCAL nTipGrp := 3, oDlg, oRadMenu, oFolder
   DEFINE DIALOG oDlg size 400,400

     @ 0,0 FOLDER  oFolder  OF oDlg PROMPTS "Folder 1"  SIZE 400,200

     @ 1,0 RADIO oRadMenu VAR nTipGrp prompt "option1","option2","option3","option4","option5","option6" OF oFolder:aDialogs[1]

   ACTIVATE DIALOG oDlg
   return nil

Re: Rad menu lost initial setting

PostPosted: Tue Oct 17, 2017 10:47 am
by AntoninoP
looks like the problem is with resources...

Re: Rad menu lost initial setting

PostPosted: Tue Oct 17, 2017 1:38 pm
by Antonio Linares
Antonino,

Please review FWH\samples\testrad.prg and testrad.rc

Re: Rad menu lost initial setting

PostPosted: Tue Oct 17, 2017 3:33 pm
by AntoninoP
testrad is without folder.

Re: Rad menu lost initial setting

PostPosted: Tue Oct 17, 2017 3:50 pm
by Antonio Linares
Antonino,

Code: Select all  Expand view
   ACTIVATE DIALOG oDlg ;
       ON INIT ( oRadMenu:aItems[ nTipGrp ]:SetFocus(), .F. )
 

Re: Rad menu lost initial setting

PostPosted: Tue Oct 17, 2017 3:59 pm
by AntoninoP
does not work

Re: Rad menu lost initial setting

PostPosted: Tue Oct 17, 2017 4:05 pm
by AntoninoP
does not work, Only this one works:

Code: Select all  Expand view

    ACTIVATE DIALOG oDlg ;
        ON INIT ( oRadMenu:aItems[ 3 ]:SetFocus(), .F. )
 


So, I change the code in this way:
Code: Select all  Expand view
#include <fivewin.ch>

proc main()
    LOCAL nTipGrp := 3, oDlg, oRadMenu, oFolder
    LOCAL nInitial := nTipGrp
   
    DEFINE DIALOG oDlg NAME "MAINDLG"
    REDEFINE FOLDER oFolder ID 4001  OF oDlg PROMPTS "Folder 1" DIALOGS "PAGE1"

    REDEFINE RADIO oRadMenu VAR nTipGrp ID 4001,4002,4003,4004,4005,4006,4045,4054,4055 OF oFolder:aDialogs[1]
    ACTIVATE DIALOG oDlg ;
        ON INIT ( oRadMenu:aItems[ nInitial ]:SetFocus(), .F. )
    ? nTipGrp
return

but it should not be necessary... :(

Re: Rad menu lost initial setting

PostPosted: Tue Oct 17, 2017 4:34 pm
by Antonio Linares
Antonino,

At least you have a workaround to solve it

We are going to review it, in the meantime you have it working

Re: Rad menu lost initial setting

PostPosted: Wed Oct 18, 2017 8:59 am
by Silvio.Falconi
I am convinced that the error is in the resource but I not Know where