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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

traping special keys during report preview vfp6

Status
Not open for further replies.

ashnam10

Programmer
Jul 18, 2007
24
IN
Dear All,

I wont to trap certain keys and activate other prg, form, preview on pressing of special keys when previewing one report.

How can i go about it
I have tried keypress event before previewing a form

Pls. help urgent
Thanks in advance
 
Thank you sir for your prompt reply

I go about it in following way

crea a form with window state modeless
give formname as myprevfrm
in the activate event i give the command
on key label 'f7' do myprog
repo form myreport preview in window myprevfrm
deactiv form
relase form

but while previewing on pressing f7 doesnot run myprog

what mistake am i making

pls. guide me urgently

Thanks
 
I don't see why you need to launch the report from within the form's Activate.

If your aim is to produce a modeless report preview, you can do it like:

Code:
loPreview = CREATEOBJECT("Form")

* Code here to customise the form in
* any way you require, e.g:
loPreview.Caption = "Report Viewer"

loPreview.Name = "MyPreview"
loPreview.Visible = .T.

REPORT FORM MyReport PREVIEW ;
  IN WINDOW MyPreview NOWAIT

Run that code from a menu command or from another form button, or whatever other point in your application you want to launch the report.

It's the NOWAIT in the above code that will make the window modeless.

You might also read my article, "Taming the VFP report preview window", at
If I have misunderstood what you are trying to do, perhaps you could clarify.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Thank you sir,

i added further few lines to your code

now the hot key is working but the report is giving nesting error which otherwise runs ok when called independently pls. go through it and show me the mistake i have done

loPreview = createobject("Form")
loPreview.caption = "Report Viewer"
loPreview.name = "MyPreview"
loPreview.visible = .t.

loPreview1 = createobject("Form")
loPreview1.caption = "Report Viewer"
loPreview1.name = "MyPreview1"
loPreview1.visible = .t.

on key label 'f7' do nextview

repo form myfirst preview in window mypreview

lopreview.release
lopreview1.release

proce nextview
********* here it gives error "report has nesting error"
*********** when i press 'f7' when previewing myfirst *******report
repo form mysecond preview in window mypreview1

thanks
 
Ashnam,

Sorry, but I can't off-hand see any reason for a nesting error. However, I'm still not clear what you are trying to achieve.

Is your aim to have two preview windows open at the same time, and to let the user switch between them? If so, it might work better if the previews were modeless (in other words, add NOWAIT to the two REPORT commands). I wouldn't be happy about using ON KEY LABEL to switch between two modal forms.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top