Writing Code
 Crystal Reports Forum : Crystal Reports .NET 2003 : Writing Code
Message Icon Topic: ReportObjectHitTest Post Reply Post New Topic
Author Message
squeaky
Newbie
Newbie


Joined: 29 Nov 2006
Location: United States
Online Status: Offline
Posts: 6
Quote squeaky Replybullet Topic: ReportObjectHitTest
    Posted: 29 Nov 2006 at 3:50am
Hi:
 
I'm hoping someone can give me information about the ReportObjectHitTest. I keep seeing it referenced, but there never seems to be any information supplied.
 
If it does what I think it does, then it's exactly what I need. My scenario:
 
I want to allow a user to search for text (using the standard TextSearch from the ReportViewer toolbar). When (if) the text is found, and the highlight box is surrounding the text, I'd like to launch another windows form.
 
Here's the thing. I don't want to launch the second form until the user clicks/double-clicks the highlighted text. Also, I need to pass the text to the second form as a parameter, to dictate what information should be shown.
 
I really hope that made sense. Any information on the ReportObjectHitTest, and how to use it, would be greatly appreciated.
 
Thanks in advance.
IP IP Logged
squeaky
Newbie
Newbie


Joined: 29 Nov 2006
Location: United States
Online Status: Offline
Posts: 6
Quote squeaky Replybullet Posted: 05 Dec 2006 at 4:54pm
Hello all:
 
I've yet to find information concerning the ReportObjectHitTest. However, downloading your free chapters helped me to accomplish the desired task. (So, meet your newest customer. I must have both of your books. They've been added to my Christmas List.) Thanks a million.
 
Using the CrystalReportViewer ObjectModel's Drill() event, I am able to pass information from the Report Document to a class that I created called Reports. This class uses the information that it receives, to select data from the database that corresponds to the received id.
 
This also allows me to determine which records information should be displayed in the form when it's launched via the Drill() event.
 
//instantiate 3 instances of the Reports object
Reports newIncReport = new Reports();
Reports newMsgReport = new Reports();
Reports newAssgntReport = new Reports();
 
private void MWSRptVwr_Drill(object source, CrystalDecisions.Windows.Forms.DrillEventArgs e)
{

//this id will be passed to the results class; it is the id that is being displayed in a Crystal Report on the main gui form

string id = e.NewGroupName;

bool found = false;

//determine which report is currently displayed
 
switch (activeReport){

case "incidents":

//pass the incident id to the reports class
 
found = newIncReport.IdentifyIncReportSelection(id);

if (found){

//do not perform the drilldown
 
e.Handled = true;

//create an instance of the New Incident form

frmNewIncident newIncident = new frmNewIncident(id);

//display the new form and information that corresponds to the id

newIncident.Show();

}

break;

case "messages":

//pass the message id to the reports class

found = newMsgReport.IdentifyMsgReportSelection(id);

if (found){

//do not perform the drilldown

e.Handled = true;

//create an instance of the Message Details form

frmMsgDetails msgDetails = new frmMsgDetails(id);

//display the new form and information that corresponds to the id

msgDetails.ShowDialog();

}

break;

case "assignments":

//pass the assignments id to the reports class

found = newAssgntReport.IdentifyAsgntReportSelection(id);

if (found){

//do not perform the drilldown

e.Handled = true;

//create an instance of the Update Assignment form

frmUpdate updateAsgnt = new frmUpdate(id);

//display the new form and information that corresponds to the id

updateAsgnt.ShowDialog();

}

break;

}

}

If you find the code useful, please, help yourself to it. Once you capture that id, there are endless possibilities! Have fun!

Note: The id argument is used in conjunction with a datareader to determine if a field value matches the id.

bool found = false;
 
while (dbReader.Read()){

if (id == (dbReader["someFieldName"])

found = true;

}

}

return found;


Edited by squeaky - 05 Dec 2006 at 5:53pm
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 05 Dec 2006 at 9:01pm
Hey Squeaky,

Glad the online books helped. Hopefully the XI book will be out early next Spring (I'm spending tonight writing about cross-tab reports).

Thanks for posting your code. I'll review it and see what nuggets of wisdom you have to share.  I'm sure I'll be able to incorporate it into the appropriate CR.NET 2005 chapter . Clap
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.