Source language: Translate to:

removing a tick & clearing a text entry box

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

removing a tick & clearing a text entry box

Postby seanie » Thu Oct 22, 2015 10:00 pm

Hello Neobook Community. I'm here again to ask for help.

This is the code for an application I'm working on:

If "[TextEntry60]" "=" "I don't have a book."
ShowObject "Picture50" "None" "0"
DisableObject "TextEntry60"
FocusObject "TextEntry61"
EndIf
If "[TextEntry60]" "=" "I do not have a book."
ShowObject "Picture50" "None" "0"
DisableObject "TextEntry60"
FocusObject "TextEntry61"
EndIf

ShowObject refers to a tick ('check' for our American friends) that shows that the correct answer has been put in the text entry field.

I'm not really happy with the next command, DisableObject, but it was a way to get around what I didn't know how to do:

What i would like is a command that says if the answer is correct, show the tick (the picture), but if the student then modifies the text, the tick disappears. In other words, the tick will only be there when the correct answer is in the text entry box. I can make it appear the first time, but I don't know how to make it disappear if the text is subsequently modified. Hope I have explained myself. Can someone explain how I could do that?

My second question: I would also like to put in a button that would enable users to clear a text entry box, but I don't know how to do that. Can it be done? I tried RefreshObject, but it didn't remove the text from the text entry box.

Thanks for reading, guys.
seanie
 
Posts: 47
Joined: Tue Jul 31, 2007 9:33 am

Re: removing a tick & clearing a text entry box

Postby Tony Kroos » Thu Oct 22, 2015 11:06 pm

1) Use "Text changed" event (see corresponding tab in object properties), place some If...Else blocks here with your conditions, it will do the job. Event fires every time when object's text changed.
2) Just set object variable to empty value (setvar "[TextEntry1]" "")
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Re: removing a tick & clearing a text entry box

Postby seanie » Fri Oct 23, 2015 5:22 pm

Thank you Tony Kroos. That worked like a charm. Peace and happiness! :)
seanie
 
Posts: 47
Joined: Tue Jul 31, 2007 9:33 am


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest