dim rgcorrect as smallint

function concat_a (      a (0) as string,
                   ByVal ct as    smallint,
                   ByVal s as     string) as string
dim c as string
dim i as smallint

do case ct
   case 0 concat_a = ""
   case 1 concat_a = a (1)
   case 2 c = a (1)
          for i = 2 to ct 
              c = c + s + a(i)
          next
end case
end function


function RGGetCorrectMultipleChoice (ByVal ttl as string,
                                           choice (0) as string, 
                                     ByVal choices as smallint,
                                     ByVal correct_answer as smallint) as
logical

rgcorrect = correct_answer

dialog title ttl
       control RadioGroup title concat_a (choice, choices, ";")
                          ID 1 
                          calling chose_one
       control OKButton   ID 2
                          calling check_answer
                          disable
       control CancelButton
RGGetCorrectMultipleChoice = CommandInfo (CMD_INFO_DLG_OK)
end function

sub chose_one
alter control 2 enable
end sub

sub check_answer
if ReadControlValue (1) = rgcorrect
   then note "Correct"
   else note "Incorrect"
        dialog preserve
end if
end sub


That'll be $75  :)
Spencer


                      

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]

Sent: Thursday, May 20, 2004 1:33 PM
To: [EMAIL PROTECTED]
Subject: MI-L RadioGroup

I am creating an educational app in MapBasic.  I have a dialog that appears
with several buttons.  When you push the button a radiogroup with four
choices appears.  What I want it to do is create a Note statement
"Incorrect" if the choice is wrong and preserve the dialog with the
radiogroup for the chance to answer again.  If the answer is correct, I
want it to Note "Correct" then go back to the main dialog.  I have been
using the "Do Case" statement but can't get this to work.  Currently, it
works using check boxes but it isn't as efficient and clean as it would be
with a radiogroup.  If anyone can help, please let me know.  I am
sllloooowwwllllyyyy learning MapBasic.  TIA

John Crouse
Integras Consulting



---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11862



---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11863

Reply via email to