forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Radio Button action (%rb)

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Sun Jun 21, 2015 2:27 am    Post subject: Radio Button action (%rb) Reply with quote

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.
Back to top
View user's profile Send private message Visit poster's website
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Sun Jun 21, 2015 2:34 am    Post subject: Reply with quote

Here is the code:
[code] TYPE:: LITHO_REC
sequence
INTEGER*2 :: FWD=0,BACK=0,CRECR=0,CMEAS=0,CUNIT=0
INTEGER*2 :: CODED=0,CBARL=0
CHARACTER*8 :: CODE=' '
REAL*4 :: FTINC=0.0,FT=0.0
CHARACTER*48 :: ENGLSH=' '
CHARACTER*40 :: SEAM=' ',ANALYT=' '
CHARACTER*16 :: COMMNT=' ', ORIGNL=' '
REAL*4 :: FT_CUM=0.0,FT_ELEVATION=0.0 ! ADDED
INTEGER*2 :: LINE_NUMBER=0
INTEGER*2 :: LOW_BED=0,HIGH_BED=0 ! when scanning seams, this is the highest and lowest encountered
CHARACTER*4 :: 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
integer*4 display_code,display_english,display_core
integer*4 multi_types
integer*4 display_code,display_english,display_core
integer*4 multi_thick,fif_sel,ft_sel,mt_sel
integer*4 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%2`tl&',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]
Back to top
View user's profile Send private message Visit poster's website
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Sun Jun 21, 2015 2:43 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Sun Jun 21, 2015 3:28 pm    Post subject: Reply with quote

damn Eddie beat me to it as I was double-checking it worked (it does) ! :O)
didn't understand the diffiult to find bit though, in the online help file search for %ga its under 'Modifiers' clear as a bell
http://silverfrost.com/ftn95-help/clearwinp/formats/_ga.aspx
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Sun Jun 21, 2015 3:31 pm    Post subject: Reply with quote

btw in wahorger's posted code, note the [code] is printed top and bottom and the code isn't formatted !!!
I've had this problem in recent times posting url's.
The one in my comment above appears as 'clickable' even though I didn't select the 'URL' buttons first before and after pasting !
The mystic wonders of php forum posting once again.
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Sun Jun 21, 2015 5:33 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Mon Jun 22, 2015 3:08 pm    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message Visit poster's website
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Mon Jun 22, 2015 8:09 pm    Post subject: Reply with quote

The point of difference between %ga and %`ga is that with the grave accent modifier you can't have all of the controls off at the same time - you would need an extra 'All Off' control.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group