Silverfrost Forums

Welcome to our forums

Radio Button action (%rb)

21 Jun 2015 1:27 #16481

I have run into behavior that appears to be odd when using ganged radio buttons. I'll post the code once I make it standalone.

I have three sections of radio buttons. Each section is ganged. When I press one of the buttons that is not selected, it become selected. If I press it again, it becomes unselected. Thus, all the ganged buttons are deselected.

This behavior is unlike other Windows radio buttons that I can find.

I have read on this forum that ganged radio buttons might be problematic. Is this yet another example?

Having to implement a separate handler (callback) for each button to insure that the button responds properly (i.e. click it, becomes selected; click it again, still selected) is not a good solution.

21 Jun 2015 1:34 #16482

Here is the code: [code] TYPE:: LITHO_REC sequence INTEGER2 :: FWD=0,BACK=0,CRECR=0,CMEAS=0,CUNIT=0 INTEGER2 :: CODED=0,CBARL=0 CHARACTER8 :: CODE=' ' REAL4 :: FTINC=0.0,FT=0.0 CHARACTER48 :: ENGLSH=' ' CHARACTER40 :: SEAM=' ',ANALYT=' ' CHARACTER16 :: COMMNT=' ', ORIGNL=' ' REAL4 :: FT_CUM=0.0,FT_ELEVATION=0.0 ! ADDED INTEGER2 :: LINE_NUMBER=0
INTEGER
2 :: LOW_BED=0,HIGH_BED=0 ! when scanning seams, this is the highest and lowest encountered CHARACTER4 :: C_LOW_BED=' ',C_HIGH_BED=' ' ! bed whose numeric value.... LOGICAL :: BED_ERROR=.true. ! required bed pairs are not there LOGICAL :: CODE_VALID=.false. ! if entered as CODE, is the code legit END TYPE LITHO_REC TYPE (LITHO_REC) MY_REC integer4 display_code,display_english,display_core integer4 multi_types integer4 display_code,display_english,display_core integer4 multi_thick,fif_sel,ft_sel,mt_sel integer4 multi_measures,indiv_thick,cum_thick

integer*4 rgb@
INTEGER*4 MY_CBARL
INTEGER I
! --- put in some test data for display
MY_REC%CODE=' 543'
MY_REC%ENGLSH = 'THIS IS ENGLISH'
MY_REC%COMMNT='cOMMENT'
MY_REC%SEAM='HZ9 2'
MY_REC%ANALYT='CO2=TOOMUCH'
MY_REC%CBARL = 1
MY_REC%ORIGNL = '10.0'

! --- BUILD THE DIALOG BOX USING THE LITHOLOGY RECORD i = winio@('%bf%2tl&',15.d0,30.d0) if(my_rec%coded.ne.0) then i = winio@('%taCoded%nl&') else i = winio@('%taNot Coded%nl&') endif I=WINIO@('Code/English&') display_code = 1 display_english = 0 i = winio@('%ta%~rs[UPPERCASE] &',my_rec%code,display_code) i = winio@('%ta%~rs[UPPERCASE]&',my_rec%englsh,display_english) i = winio@('%nl&') i = winio@('Thickness%ta%10rs[UPPERCASE]&',my_rec%orignl) display_core = 0 i = winio@(' Barrel %~4rd&',MY_CBARL,display_core) i = winio@('%nl&') i = winio@('Comment%ta%rs[UPPERCASE]%nl&',my_rec%commnt) i = winio@('Seam Tags%ta%rs[UPPERCASE]%nl&',my_rec%seam) i = winio@('Analysis Tags%ta%rs[UPPERCASE]%nl&',my_rec%analyt) i = winio@('%ob[named_l][Litho Type]&') multi_types = 1 i = winio@('%~rb[code]%nl&',display_code,multi_types) i = winio@('%~rb[English]%nl&',display_english,multi_types) i = winio@('%2ga&',display_code,display_english) i = winio@('%cb&') ! --- Thickness format multi_thick = 1 fif_sel = 1 ft_sel = 0 mt_sel = 0 i = winio@('%ob[named_l][Thickness]&') i = winio@('%~rb[Feet/In/Frac]%nl&',fif_sel,multi_thick) i = winio@('%~rb[Dec. Feet]%nl&',ft_sel,multi_thick) i = winio@('%~rb[Meters]%nl&',mt_sel,multi_thick) i = winio@('%cb&') i = winio@('%3ga&',fif_sel,ft_sel,mt_sel) ! --- Thickness Measures multi_measures = 1 indiv_thick = 1 cum_thick = 0 display_core = 0 i = winio@('%ob[named_l][Thickness Measures]&') i = winio@('%~rb[individual Thickness]%nl&',indiv_thick,multi_measures) i = winio@('%~rb[Cumulative Thickness]%nl&',cum_thick,multi_measures) i = winio@('%~rb[Core Barrel Thickness]%nl&',display_core,multi_measures) i = winio@('%cb%nl&') i = winio@('%3ga&',indiv_thick,cum_thick,display_core) i = winio@(' ') MY_REC%CBARL = CBARL end [/code]

21 Jun 2015 1:43 #16483

Your %ga must have the grave modifier to ensure that one control is always on, as in %`ga. [It says so in FTN95.CHM - but it takes some finding!]

Otherwise, what effect did you expect the second click on an already selected radio button to have?

All the same, I've found ganged radio buttons to be a problem in the past. If you are going to handle the on/off codes in a ganged set yourself, then it helps if the codes are in an array, which is one place that EQUIVALENCE comes in handy.

Eddie

PS It is in the alphabetical format code reference section.

21 Jun 2015 4:33 #16484

I must add a search of the online help as well as FTN95.CHM and the ENH files, as you can learn something from each despite their many similarities. For example, I never ganged %tb buttons. Was this because I didn't know you could? There doesn't appear to be an example, and I don't remember seeing it before I looked at the link.

Can you gang %ib buttons too?

22 Jun 2015 2:08 #16493

Eddie and John, you guys are the best!! Of course the grave would have to be specified, otherwise the ganging would not truly make sense!

I was looking to get the radio buttons to respond like they should in Windows, when a button is selected when ganged, it stays selected regardless of what you do to that specific control.

Thanks a bunch. Saved me a lot of work also; was getting ready to use a different method.

Eddie: Appreciate the advice also. The production code will have the equivalences and data arrays in place. I like to test a new method with simple data before I commit to enveloping it with the production data. This is only one small piece of a larger feature that will be added to the production code. But it is key!

22 Jun 2015 7:09 #16496

The point of difference between %ga and %`ga is that with the grave accent modifier you can't have all of the controls [u:fdf51310e8]off[/u:fdf51310e8] at the same time - you would need an extra 'All Off' control.

Please login to reply.