Solved

Printing crviewer control by pressing one key only

Posted on 2003-11-02
8
480 Views
Last Modified: 2008-01-09
Hi, I have a form (frmReport) which has one control on it (crvReport).

What I would like is when you press the "/" (Asc(47)) button the form must close and when pressing the "*" (Asc(42))  button the form must print and close.

The trouble is there is no keyboard event for the crviewer control.

What can I try?

TIA
0
Comment
Question by:jinxster
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
8 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 9668698
Nothing in CR that I am aware of since it cannot respond to a keypress event.

I wonder if you could put a timer on the form and have it check for a keypress through Windows API calls.  I don't know how to do it but it might be possible.

mlmcc

0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9670532
?

If you set keypreview to true on the form, you should get the form's key_press event.
Am I missing something?
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 9671054
Eddy - The Crystal control only exposes the click events.

mlmcc
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 

Accepted Solution

by:
jinxster earned 0 total points
ID: 9672002
Hi, Eddy, the keypreview property means that if controls on the form have a key(press, up, down) but nothing is inside, the form's key(press, up, down) prevails.

I found a work around, (without using API)

Basically, it goes like this:

Add a textbox on the form and make sure it is behind the crviewer control.
Write the necessary code in the key_press, key_down, key_up events of the textbox.
In the viewchanged AND gotfocus event of the crviewer control add: textbox.SetFocus

The events should work. This also works nicely to make page up and page down scroll through pages home goto first page, end goto last, etc.

Thanks.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 10170900
PAQ.  no refund unless he responds
0
 

Author Comment

by:jinxster
ID: 10176313
I gave my own solution so I do not feel anyone really earned any points, sorry.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question