[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 491
  • Last Modified:

Printing crviewer control by pressing one key only

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
jinxster
Asked:
jinxster
  • 3
  • 2
1 Solution
 
mlmccCommented:
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
 
EDDYKTCommented:
?

If you set keypreview to true on the form, you should get the form's key_press event.
Am I missing something?
0
 
mlmccCommented:
Eddy - The Crystal control only exposes the click events.

mlmcc
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
jinxsterAuthor Commented:
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
 
mlmccCommented:
PAQ.  no refund unless he responds
0
 
jinxsterAuthor Commented:
I gave my own solution so I do not feel anyone really earned any points, sorry.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now