Jump to content

Answer Y or N via Keypress or Button


This topic is 7575 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I am making a FP5.5 solution, containing a quiz with 25 questions, that the user needs to answer with a Yes or a No.

I have made the corresponding scripts, attatched them to, and placed corresponding Y/N buttons on the layout.

What I also would like to do is to let the user answer by pressing the Y or the N key on the keyboard, if they chose not to use the mouse.

The only (un-elegant IMHO) solution i've managed to do, is the following script:

Allow User Abort("Off")

Set Field("keyinput","")

Loop

If("keyinput = "j" or keyinput = "J" or keyinput = "n" or keyinput = "N"")

Perform Script ("Next_Question")

Exit Script

End If

If("keyinput <> "j" or keyinput <> "J" or keyinput <> "n" or keyinput <> "N"")

Set Field("keyinput","")

End If

Goto Field("keyinput")

Pause/Resume Script("0:00:01")

End Loop

The field keyinput is a global Text field, which has been hidden on the layout with a size of height 1 and width 1, and font size 1 point.

I was wondering if anybody have an easier and better solution.

Plugins as well, but preferably freeware, as this solution is going to be distributed free of charge.

Was wondering if there were any plugins which could execute a script upon a keypress, as the 50 times pr second check of an event, would generate a much more pleasant and fluid user experience, than the "lag" of 1 second involved in the above script.

Maybe grounds for a feature request in the next FMP version, to be able to define a key to be attached to a button on a layout.

B. Regards

Johds

Link to comment
Share on other sites

Hi Johds,

Welcome to the Forum. smile.gif

You have the right idea by placing a 1x1 field next to your button (or checkbox). But it doesn't have to be a global - it can be your Answer field itself. And use a Value List.

The User can either click the button (or checkbox) or type.

I've attached a demo which was a reverse-engineer of one of CobaltSky's demos and addresses more the find issue but will certainly work for you. smile.gif Sorry I don't have time to explain it out for you but the demo is pretty simple. If you have questions, I'd be happy to explain further when I get home tonight.

Cheers,

LaRetta

Link to comment
Share on other sites

Hi LaRetta,

Thanks for the welcome, and the solution. I'm doing something similar, though I need the global as a "flag", for the Next_Question script to do various stuff depending on a Yes or a No answer.

I don't need the answer displayed on the layout where the quiz is taking place, as all 25 answers are stored and checked at the end of the Next_Question script, when the question counter has reached 25.

The problem for me, is that the loop used in my above script is slow and only checks for the users input once every second. What I was hoping for was a solution with a "finer grained" timing, than possible with the Pause/Resume script step.

Thats the reason I mentioned going by a plugin. Things would have been so much easier if we could attach a key to a button. For instance by labeling the button &Yes and &No, where the character following the ampersand would define the key to be pressed, in order to execute the script attached to the button.

Filemaker could have implemented that either like I just described or by giving us the possibility to attach a key to the button in the Button definition dialog. Would have made a mouse and keyboard driven user-interface so much easier to accomplish. Wonder why they didn't confused.gif

Link to comment
Share on other sites

This topic is 7575 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.