2016년 12월 29일 목요일

How get an answer and add one point?


Hi!! Im working on a project about counting syllables, the thing is I show you the word and you must write in a text box how many syllables the word has. 
In the interface I add a text box to write the answer, a button to get the next word and a Label that the function is like score, so I´d like when the person write the correct answer get one point and the text box is empty again to write the next answer, and if the answer is no correct just get the next word but doesnt add points.
I dont know how I can comparate the answer to get the point. I add the screenshot about what I made. Thank you so much!! Any help would be really appreciated. 

Captura de pantalla 2016-04-27 11.49.41.png 표시 중

--
I think it would help you if you add a button to your screen that says "Check answer" or similar. The gotFocus is not so reliable and moreover, you want to check when the textbox loses focus. There is no event for that. Try this, and report back.

-- 
About the gotFocus you are right, but I did not know how start it, maybe I can try just with button1, it would be the button1 to get the next word and add the point if the answer is correct. if I add a button "check button" in blocks how can I make it? although I need get the final score in a date base. My problem is how to compare the answer written in the text box with the right syllables in the list made and consequently add one point. Perhaps instead write the number like "math" of syllabes in the list like the right answers I can put the right number like "text".

Captura de pantalla 2016-04-27 13.21.42.png 표시 중

-- 
It seems that you are missing some basic knowledge, therefore I should start with this:

Taifun's top 5 tips to learn AI2

Then: Rename button1 to something more clear (in the design screen), for example btnCheck. The blocks will automagically change too.
Your logic is rather redundant:
if Textbox1 (rename this one too!) = the list selection then ... else...
In your else you are checking the same thing again, but you could just use the else.
The else you have there can never be reached, because either the first then was true, or in your blocks the next then is true.

Further, the when Button1.Click block requires that Button1 is enabled (you cannot click on it otherwise), so this statement is useless.
Also useless is set LabelScore Text to LabelScore text. Here you are setting a field to a value it alsready has.
But... you are making progress!

-- 
Thank you so much!! Im gonna try it! i saw a lot of tutorials but I did not see the advanced tutorials that there are in the link you say! 

-- 

댓글 없음:

댓글 쓰기