Need help with "disabling" a button!
Posted: Fri Jan 06, 2017 5:13 am
				
				Hi! I am extremely new to LiveCode and am working on creating a program that will do instructional trials. A student clicks the "Ready" button, and four letters appear on the screen and an audio file plays saying "Touch the Letter A". After the student clicks on one of the letters, feedback will be given based on whether the person touches the correct letter or not, then the process repeats for the next "trial", if you will. Everything works perfectly, except the "Ready" button, which is what populates the fields for the next trial, can be clicked at any point during the feedback. The feedback continues on as normal, but as soon as the feedback is finished, the next trial populates immediately. I would like for the student to have to wait for the feedback to finish before being able to click the "Ready" button, so that I know they are actually ready and are not just clicking indiscriminately. I've tried everything I can think of and everything I've been able to find by Googling - covering with another button then hiding and showing the extra button, using enable and disable functions for the Ready button, etc., and nothing seems to work. Does anyone have any suggestions? (Please pardon me if this is an incredibly dumb question, or if my code is a complete mess - I'm very very new to this and have cobbled together what I can, but I'm sure to more experienced eyes it's pretty rough). 
The code on button "Ready" is simply to do pickQuestion on mouseUp. 
Many thanks in advance!!!
			Code: Select all
on openCard
   put field "MasterList" into field "questionBank"
  hide field "MasterList"
  hide field "questionBank"
  show button "Ready"
end openCard
on pickQuestion
   put number of lines in fld "questionBank" into lineCount
   if lineCount = 0 then
      go to card ResultsCard
      exit to top
      end if
      put random(lineCount) into currentQues
   put line currentQues of fld "questionBank" into qLine
   delete line currentQues of field "questionBank"
   put item 1 of qLine into fld "Question"
   put "answer1 answer2 answer3 answer4" into fldList
   repeat with i = 2 to 5
      get random(the number of words in fldList)
      put word it of fldList into fldName
      delete word it of fldList
      put item i of qLine into fld fldName
      if i = 2 then
         put item i of qLine into corrTarget
         set the corrAnswer of group "groupLetters" to corrTarget
      end if
   end repeat
    put 278,205 into location1
   put 732,205 into location2
   put 278,534 into location3
   put 732,534 into location4
   put fld "answer1" into currentTarget
   set the loc of group currentTarget to location1
   put fld "answer2" into currentTarget
   set the loc of group currentTarget to location2
   put fld "answer3" into currentTarget
   set the loc of group currentTarget to location3
   put fld "answer4" into currentTarget
   set the loc of group currentTarget to location4
   show group groupLetters
   show group "Animal 1"
   show group "Animal 2"
   show group "Animal 3"
   show group "Animal 4"
   hide button "Ready"
   if corrTarget = "Animal 1" then
      play audioclip "touchGo.wav"
   end if
   if corrTarget = "Animal 2" then
      play audioclip "touchRun.wav"
      end if
end pickQuestion
on checkAnswer
   put fld "Question" into CurrentTrialNumber
   put the corrAnswer of group "groupLetters" into checkWork
   put checkWork into fld "checkWork"
  if target = fld checkWork then 
     put "J" into fld "Feedback"
     put "Correct" into fld CurrentTrialNumber on card ResultsCard
     play audioclip "Praise.wav"
     hide group "groupLetters"
     show fld "Feedback"
     wait 4 seconds
     put empty into fld "Feedback"
     hide fld "Feedback"
  else
     put "Wrong" into fld CurrentTrialNumber on card ResultsCard
     if checkWork = "Animal 1" then
        play audioclip "CorrectionGo.wav"
        hide group "Animal 4"
        hide group "Animal 3"
        hide group "Animal 2"
        show group "Animal 1"
        wait 4 seconds
   end if
   if checkWork = "Animal 2" then
      play audioclip "CorrectionRun.wav"
      hide group "Animal 1"
      hide group "Animal 3"
      hide group "Animal 4"
      show group "Animal 2"
      wait 4 seconds
      end if
  end if
  hide group "groupLetters"
 
    put empty into field "Question"
   put empty into field "Answer1"
   put empty into field "Answer2"
   put empty into field "Answer3"
   put empty into field "Answer4"
   wait 1 seconds
   show button "Ready"
end checkAnswerMany thanks in advance!!!
