Page 1 of 1

Add custom button to preview toolbar

Posted: Thu Feb 05, 2009 4:07 am
by cleanac
Hello.

I'm using a class to show and edit reports. I'm trying to add a custom button to the preview toolbar, but it won't work.

Here is the code i use.

Code: Select all

//first i create the report object
StiReport rReport = new StiReport();

//then i do some loading stuff.....

//code for adding custom button
StiPreviewForm frmPrev = new StiPreviewForm(rReport);
Stimulsoft.Controls.Win.DotNetBar.ButtonItem btnEdit = new Stimulsoft.Controls.Win.DotNetBar.ButtonItem();
btnEdit.Text = "TestButton";
btnEdit.Click += new EventHandler(btnEdit_Click);
btnEdit.Visible = true;
frmPrev.ViewerControl.ToolBar.Items.Add(btnEdit);

//show the report
rReport.Show();
The button simply won't show up. Is there any other way to do it?

Thanks

cleanac

Add custom button to preview toolbar

Posted: Fri Feb 06, 2009 11:45 am
by Edward
Hi,

Please modify the code a little bit:

Code: Select all

//create the report object
StiReport rReport = new StiReport();
rReport.Load("myReport.mrt");

//code for adding custom button
StiPreviewForm frmPrev = new StiPreviewForm(rReport);
Stimulsoft.Controls.Win.DotNetBar.ButtonItem btnEdit = new Stimulsoft.Controls.Win.DotNetBar.ButtonItem();
btnEdit.Text = "TestButton";
btnEdit.Click += new EventHandler(btnEdit_Click);
btnEdit.Visible = true;
frmPrev.ViewerControl.ToolBar.Items.Add(btnEdit);            
rReport.Render();
//show the custom created form with a previewControl in it
frmPrev.Show();
Thank you.

Add custom button to preview toolbar

Posted: Sat Feb 07, 2009 1:52 am
by cleanac
Hello,

Works great.

Thank you.

Add custom button to preview toolbar

Posted: Mon Feb 09, 2009 9:05 am
by Edward
Hello.

Please let us know if any additional help is required.

Thank you.