Custom print preview and new button
Hi,
I have a small problem regarding extra button on custom print preview. Following advices on rbWiki and many posts about it here I succesfully created print preview with additional button which is used for creating PDF of the report previewed and then the file is sent to uniform dialog box for sending coded e-mails. Since I have 2 buttons for sending e-mails on the print preview, I want that added button has new image (glyph), which is similar to existing.
I overrided CreateToolBarItems procedure as follows:
Thank You very much in advance and best regards,
Goran
I have a small problem regarding extra button on custom print preview. Following advices on rbWiki and many posts about it here I succesfully created print preview with additional button which is used for creating PDF of the report previewed and then the file is sent to uniform dialog box for sending coded e-mails. Since I have 2 buttons for sending e-mails on the print preview, I want that added button has new image (glyph), which is similar to existing.
I overrided CreateToolBarItems procedure as follows:
procedure TppAdxPreview.CreateToolbarItems; var idx1, idx2 : Integer; begin inherited; idx1 := Toolbar.Items.IndexOf(EmailButton); Toolbar.BeginUpdate; FCodedEmailButton := Toolbar.AddButton(); FCodedEmailButton.ImageIndex := ToolImageList.AddTool('PPCODEDEMAIL'); FCodedEmailButton.OnClick := ehToolbutton_Click; FCodedEmailButton.Tag := 100; FCodedEmailButton.Hint := 'Send coded e-mail'; Toolbar.EndUpdate; idx2 := Toolbar.Items.IndexOf(FCodedEmailButton); Toolbar.Items.Move(idx2, idx1); end;Newly created bitmap ppCodedEmail.bmp is stored in resource under the code PPCODEDEMAIL. I have added the resource under whole project and leter moved it in special and to the preview dedicated resource list. Unfortunatelly the button shows image under code PPNOIMAGE. If I use some code used for other buttons in RB it normally shows. I rebuilded the resource numerous times, also the project but no success. What am I missing? I am using RB 18.01.
Thank You very much in advance and best regards,
Goran
Goran Brumen
Audax d.o.o.
Audax d.o.o.
Comments
The TppToolImageList simply utilizes the Windows API to access resource files. See the ppBitmapFromResource routine in the ppUtils.pas file for how this is done in ReportBuilder.
It appears that the Windows API cannot find your resource. This could be caused by it being loaded incorrectly or an invalid file format. I suggest creating a simple Delphi application to test loading the resource image to a TImage or other Delphi component before attempting with ReportBuilder.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I have looked at that routine, yes and I was wondering as well why the resource can't be found. Maybe due to the Windows 10 (build 1709), don't know. I finally modified the routine as below and it works. The only thing I am uncertain is if the index assigned is correct. And the resource file attached to this unit is very simple: Best regards,
Goran
Audax d.o.o.