• Welcome to PlanetSquires Forums.
 

Option Button

Started by SeaVipe, February 26, 2016, 07:21:47 PM

Previous topic - Next topic

SeaVipe

Hello,


I am having some difficulty with Option Buttons.


I have an Option Button array on a form. The User can select 1 of 3 choices 0, 1 or 2. This value is written to an ini file and retrieved the next time the form is loaded/created. The value is written correctly to the ini file, (although here I am using the ControlIndex value.) To retrieve the value from the ini file is simple enough and the value is correct.


The next step is to modify the Option Button that matches the User's previous choice,; IE 0, 1 or 2. These values cannot be used to identify the Option Button. Originally I discovered (trial end error) that the first button in the group was actually idButtonControl 1011 and the last button was idButtonControl 1013. So if the User had previously selected the middle button his choice was actually idButtonControl 1012. Here is my problem: over time the idButtonControl value has changed. For a while the range was 1021/1023 then 1022/1024 today it is 1024/1026.


I'm using FF_CONTROL_SETOPTION( HWND_FORM1, 1024, 1026, users_choice_variable + 1024 )  which will work until the idButtonControl values mysteriously change...


Any help figuring this out would be appreciated.


Thanks, Clive
Clive Richey

Paul Squires

Hi Clive, maybe jut try just using the code generated IDC_'s for the option buttons:

Instead of:
FF_CONTROL_SETOPTION( HWND_FORM1, 1024, 1026, users_choice_variable + 1024 )

Try:
FF_CONTROL_SETOPTION( HWND_FORM1, IDC_FORM1_OPTION1, IDC_FORM1_OPTION3, IDC_FORM1_OPTION1 + user_choice_variable )

Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

Also, in this case you should be using the "Index" property value rather than the "ControlIndex". The Index value specifies the ordering of the option buttons within the same option group.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

SeaVipe

Clive Richey