Question
“How do I add hot key support to the preview window? For instance pressing F8 prints the report?”
Solution
Create a preview plugin that overrides the KeyDown routine. From there you can capture any key presses and perform any task you need.
Download: HotKeyPrintPlugin.zip
Sample Delphi code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
type TmyHotKeyPrint = class(TppPreview) public procedure KeyDown(var Key: Word; Shift: TShiftState); override; end; implementation { TmyHotKeyPrint } procedure TmyHotKeyPrint.KeyDown(var Key: Word; Shift: TShiftState); begin inherited KeyDown(Key, Shift); if (Shift = []) and (Key = VK_F8) then Print; end; initialization TppPreviewPlugIn.Register(TmyHotKeyPrint); finalization TppPreviewPlugIn.UnRegister(TmyHotKeyPrint); end. |