Writing radio to a file

Sarah sarahr at genesearch.com.au
Wed Nov 6 18:07:01 EST 2002


I have a generic handler that writes a preferences file, using all the 
cards & controls on a stack, including radio buttons. The advantage of 
this is that when you change your preference objects, you don't need to 
change this handler. Then you need a corresponding handler to read 
these settings and change the display accordingly.

  put "" into prefs
   repeat with c = 1 to the number of cards in this stack
     put cr & "Card: " & the short name of card c & cr after prefs
     repeat with f = 1 to the number of fields in card c
       -- save all editable fields
       if the lockText of fld f of cd c = false then
         put the short name of fld f of cd c & "§" & fld f of cd c & "¶" 
& cr after prefs
       end if
     end repeat
       -- save settings for radio buttons & check boxes
     repeat with b = 1 to the number of buttons in card c
       if the style of btn b of cd c is in "radiobutton,checkbox" then
         put the short name of btn b of cd c & "§" & the hilite of btn b 
of cd c & "¶" & cr after prefs
       end if
     end repeat
     put "¶¶¶" & cr after prefs
   end repeat

While this is a generic preferences handler, if you are only using 
radio buttons, it is probably easier just to find the 
"hilitedButtonName" of the group.

Cheers,
Sarah


On Wednesday, November 6, 2002, at 02:09  am, Timothy Hart wrote:

> Alright.  I have figured out how to group radio buttons and set their 
> behavior to true you can only have one highlighted.  Atleast I did it 
> like this.  I just grouped them and doubled clicked on one and 
> scripted:
> "set the radiobehavior of group to true"  That seemed to have worked.
>
> Now my question is how can I script it to write the choice of a user 
> to a file.  I want to give a little quiz to people and have multiple 
> choice questions.  I want my output to be a text file that they can 
> then send to me or even better have rev do
> it.  But that might be getting ahead of myself.  Anyone have any 
> ideas?  Thanks.
>
> -Tim





More information about the use-livecode mailing list