I've returned to LiveCode after a long hiatus.
I'm developing a desktop app to allow students to do multiple-choice tests and reviews at home as there will be no in-person lectures for the foreseeable future. For now, each card will contain a question with five answer choices, fields Answer A, Answer B, Answer C, Answer D, and Answer E in a group named Answer Choices. The group contains the handler chooseAnswer, which is invoked when a student clicks on one of the five fields, so each field contains the mouseUp handler
Code: Select all
on mouseUp pButtonNumber
chooseAnswer
end mouseUp
Code: Select all
on chooseAnswer
if the owner of the target is not me then pass chooseAnswer
else
lock screen
repeat for each line thisFldID in the childControlIDs of me
set the backgroundcolor of field number thisFldID to empty
end repeat
unlock screen
set the backgroundcolor of the target to "230,237,247"
put the abbrev date && the long time & tab & \
the short name of this card & tab & the short name of the target & \
return after field "Log"
end if
end chooseAnswer
- Is the placement of the chooseAnswer handler within the group the best (whatever that may mean) way to catch the selected answer?
- The childControlIDs group property make it very easy to cycle through the child fields in the group. But what if I add other controls to the group that are not fields? Is there a way to parse the list of IDs into, say, buttons, fields, etc?
- What is the *Behave like a background* group property? Should that be enabled if I want the group to appear on each card, but the text (answer choices) contained in the child fields to be different as each card will be a different test question?
Any tips are much appreciated.
Greg