Strings

You have completed your first interactive designs with QuarkXPress 7, 8 & 9 and now have need for more advanced functionality. Discuss Expressions here, ask questions and learn more about them.
Please note that Flash (SWF) authoring is not supported in QuarkXPress 10 anymore.
cfb
Posts: 0
Joined: 05 Sep 2007, 21:26

Strings

Post by cfb » 20 Nov 2007, 17:37

I've created a simple layout with a text block that contains a user-input answer and I want to enter a 2 or three digit number as an answer to a calculation.

ie: 1+1= 2
35+ 25= 60

I am using a script when hitting a key: Box1.Append(1)
That works well for single digit answers, but not for anything with 2 digits.

How can I allow for multiple digit key inputs for an answer like "60" ?

Thanks!
Cliff

Kabir(Quark)
Posts: 5
Joined: 30 Oct 2006, 23:29

Strings

Post by Kabir(Quark) » 21 Nov 2007, 01:16

Hi Cliff

I am not entirely clear on exactly what the flow of your project is. But if you are creating some sort of Q&A page , then I suggest you use an editable text box , where the user can simply enter the answer in an editable text box (made by selecting "editable" from the Display as drop down in the object tab) . Whats more , you could choose data type as number so that the user is not able to enter any alphabets. So you could use two text boxes , one for the Q and one for the A.

And you could create a script to validate that answer in the editable text box by hitting a key , say A or clicking a button , after the user has entered the answer.

Does this help?

Regards,
Kabir
QuID QA
kschandhoke@quark.com

cfb
Posts: 0
Joined: 05 Sep 2007, 21:26

Strings

Post by cfb » 21 Nov 2007, 07:45

That sort of works...
Can it be done without clicking on the box to enter text? In other words, I want the user to enter a numerical answer to a problem (5+5=10) without having to click on a text box. Simply by keying in the number the answer should appear in the text box. Your solution seems to require that I click first. Can I eliminate the click step?

I want to simplify this as much as possible.

The simple math problem comes up on the screen.
The user reads it.
The answer is input and appears on screen, if it is a correct answer.

Matthias Guenther (Quark)
Quarkian
Quarkian
Posts: 2490
Joined: 04 Jun 2004, 15:06
Contact:

Strings

Post by Matthias Guenther (Quark) » 24 Nov 2007, 04:10

Hi, Cliff,

you describe an interesting problem.
Let's say your question is 7+3. When do you want to start processing the answer? After the first key stroke? Well, then nobody can enter the correct answer. After the second? Then wrong answers (like 9) will loop forever. I suppose you could work with a time out...

If you want such a solution you need to experiment with keys and collect the user input. Kabir's suggestion (to have a text box) seem to be easier.

However, if it is only the activation click for the text box that you want to avoid, then the solution is easy:
1. Create a script
2. In this script use the action "Text > Select > 'your editable text box' > All"
3. Make this script your page entry script.

Does that help?
Matthias

cfb
Posts: 0
Joined: 05 Sep 2007, 21:26

Strings

Post by cfb » 27 Nov 2007, 17:14

Hi Matthias,
That works well except I am able to input incorrect answers, which I want to avoid. I want the program to reject wrong answers somehow.

5+5= Let's say I input 20 as an answer for this. Entering a wrong answer should create a wrong sound or something.

This is why I approached this using a number approach instead of a text box approach. I need to write a script that rejects all but the right answer and inputs it in the text box when it is typed.

If I type 25 - WRONG!
If I type 17 - WRONG!
If I type 10 DING DING DING!! and the answer appears in the text box.

Matthias Guenther (Quark)
Quarkian
Quarkian
Posts: 2490
Joined: 04 Jun 2004, 15:06
Contact:

Strings

Post by Matthias Guenther (Quark) » 28 Nov 2007, 03:32

Hi, Cliff,

will your results always be two digits? Or also one and three?

Thanks
Matthias

cfb
Posts: 0
Joined: 05 Sep 2007, 21:26

Strings

Post by cfb » 28 Nov 2007, 12:52

one, two or three digits

Matthias Guenther (Quark)
Quarkian
Quarkian
Posts: 2490
Joined: 04 Jun 2004, 15:06
Contact:

Strings

Post by Matthias Guenther (Quark) » 28 Nov 2007, 12:58

Hi, Cliff,
[strong]cfb:[/strong]one, two or three digits
and how do you decide that the user has finished inputtig the answer? Time-based? Idle time based?
Already when the answer is wrong (e.g. if you expect 123 and somebody types 1+3)?

Thanks
Matthias

cfb
Posts: 0
Joined: 05 Sep 2007, 21:26

Strings

Post by cfb » 28 Nov 2007, 15:56

Good question!
I guess idle time based.

Does it need to be time based? Can the script wait for the correct answer and input it when/if that is keyed in?

Matthias Guenther (Quark)
Quarkian
Quarkian
Posts: 2490
Joined: 04 Jun 2004, 15:06
Contact:

Strings

Post by Matthias Guenther (Quark) » 29 Nov 2007, 01:36

[strong]cfb:[/strong]Does it need to be time based? Can the script wait for the correct answer and input it when/if that is keyed in?
I am positive that would be possible.

However let's pin down how you want to have it behave. Let's say your answer is 123. Somebody mis-keys 2 and then 1+2+3. Would you accept that? If it is not time based or doesn't wait for three digits, it would be the same as inputting 212, right? That's why maybe timebased, take the last (max three) keys that the user keyed in (within a given time).

Best
Matthias

Locked

Return to “Expressions”