How can i create multiple choice questions GUI using Guide ?
Afficher commentaires plus anciens
I need to create a GUI with Multiple Choice Questions
There will be 15 questions, four choices for each question,push button to submit the answer and there will be 15 stars. if the user selects a correct answer the star becomes green,if not star will turn to red.
I need to know which choice the user has selected ?
I attached an snapshot of how i did it.
I tried to insert the stars but it didn't seem to work.
Hope somebody can help me. Thanks in advance.
2 commentaires
Prashanth Damojipurapu
le 6 Juil 2016
Geoff Hayes
le 6 Juil 2016
I think that you would have a Next button to go from one question to the next. In the callback for this button, you would need to update the question and answers for that next question.
As for the star, you mentioned I tried to insert the stars but it didn't seem to work. What did you do? Do you have a green star image and a red one?
Réponses (3)
Image Analyst
le 7 Juil 2016
3 votes
The best way to have 15 questions, if you don't want to take up your whole screen, is to use a popup control (a drop down list).
Alternatives would be a listbox control,
or calling the menu() function to popup a dialog box but that only lets them interact when you call the function, not whenever they want like a control.
Again, I recommend the popup control as the best option for letting the user choose from a list of 15 options.
4 commentaires
Prashanth Damojipurapu
le 7 Juil 2016
Modifié(e) : Prashanth Damojipurapu
le 7 Juil 2016
Image Analyst
le 7 Juil 2016
No. Making the user slide a slider (scrollbar) and then telling them what option they "are on" via a static text label would be a horrible, user-hostile way of letting a user pick from a set of options.
Prashanth Damojipurapu
le 7 Juil 2016
Image Analyst
le 7 Juil 2016
If you want to let them pick from a continuum of values, then a scrollbar would be okay, like "How much do you like this product on a scale of 0 to 10?" But it would not be good for a discrete set of choices.
Geoff Hayes
le 5 Juil 2016
Prashanth - if your radio buttons have been created within a uipanel (which given your screenshot appears to be the case) then you can get the selected radio button from within the pushbutton callback as
function pushbutton1_Callback(hObject, eventdata, handles)
hSelectedRadioBtn = get(handles.uipanel1,'SelectedObject')
The above assumes that the Tag property for your panel has been set to uipanel1. Once you have the handle to the radio button, you can check its string to see what answer the user has selected.
1 commentaire
Prashanth Damojipurapu
le 5 Juil 2016
Modifié(e) : Prashanth Damojipurapu
le 5 Juil 2016
Shameer Parmar
le 7 Juil 2016
1 vote
Hello Prashanth,
Check the attached scripts..
Run the Test.m file and see the results..
Go through the logic added into callback of functions...Let me know if you dont get the logic..
7 commentaires
Prashanth Damojipurapu
le 8 Juil 2016
Modifié(e) : Prashanth Damojipurapu
le 8 Juil 2016
Prashanth Damojipurapu
le 8 Juil 2016
Shameer Parmar
le 14 Juil 2016
Modifié(e) : Shameer Parmar
le 14 Juil 2016
Prashant,
Thanks for the response..
Actually, As per my knowledge till I have, we can not add star, because there is no star button. But We can put the square box instead of star.
How to do it :
1. Simply select the static textbox (which is square like structure always) and put just beside the question statement.
2. The default text of static textbox should be removed and make it blank. and change the back ground color as same of the back ground color of your GUI. (In this way it will always look like hidden box)
3. Now you need to apply logic (as same I applied for changing the text color of question statement). The logic should be like, if the selected answer is correct, the box should be highlight with green backGroundColor, if wrong then should highlight with RED BackGroundColor.
If you want this kind of structure, I can help you.. :)
Prashanth Damojipurapu
le 15 Juil 2016
Modifié(e) : Prashanth Damojipurapu
le 19 Juil 2016
Shameer Parmar
le 20 Juil 2016
Prashanth,
Please find attached updated Question format..
Prashanth Damojipurapu
le 27 Juil 2016
Prashanth Damojipurapu
le 2 Août 2016
Catégories
En savoir plus sur Interactive Control and Callbacks dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!