Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent Escape in Report Preview

Status
Not open for further replies.

glamb

Programmer
Dec 29, 2009
32
0
0
US
Is there a way to prevent a user from using the escape button and force them to use the close button on the report preview toolbox?
 
Sure. Just issue this command immediately before running the preview:

Code:
ON KEY LABEL ESC *

After the preview, do this to reverse the action:

Code:
ON KEY LABEL ESC

But are you sure you want to do this? If users expect to press ESC to close the report, you risk confusing them if you disallow it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Thanks, Mike.
And no, hopefully it will make things simpler to click the close icon on the report preview toolbar. Right now three reports are previewed in a row. When the user uses escape, the next report preview is on top but not active, so the escape doesn't work and they think they are stuck. It is simpler to have an instruction to use the 'close' icon on the preview toolbar.
 
In regard of ESC key there are three things you can do in VFP

ON KEY LABEL ESC *
ON ESCAPE *
SET ESCAPE OFF

I'd say SET ESCAPE OFF is a good idea anyway, if you don't want to allow program interruption. ON ESCAPE then has no effect. But ON KEY LABEL ESC still has. So do

ON KEY LABEL ESC *
SET ESCAPE OFF

Bye, Olaf.
 
The only problem with requiring them to use the Close button is that it requires the user to be able to use the mouse. What happens when you get a user who doesn't have the dexterity for that (for example, a quadriplegic using a mouthstick to hit the keyboard, or a blind user using a screen reader)?

Every action in an application should be available both by keyboard and by mouse.

Tamar
 
There's still CTRL+F4 to close the preview via keyboard. Or whatever general shortcut for the X button there is.

But it's right that totally disabling ESC is bad, for it's also the default key for any CANCEL action, and in vfp commandbuttons with Cancel=.T. also are "clickable" via ESC.

You do suppress default behaviour, I assume you still have a reason to do this.

Bye, Olaf.
 
When the user uses escape, the next report preview is on top but not active, so the escape doesn't work and they think they are stuck.

In that case, I would try to figure why the next report is not active, and do something to fix it.

If I had to show three reports in a row, I think I would display some sort of control with three buttons on it that would let them switch back and forward between the reports at will. And also perhaps show each report in a custom form. That would give the user more control, and generally provide a better interface.

That said, I've never had to do that, and it might not be a good option for your application. It's just a thought.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Thanks, everyone. This is a inhouse app and doesn't need to be perfect, just not confusiong. The ESC suggestions work great!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top