0

I am working on a label printing project and I am using FastReports and also a TJvWizard from the JEDI Components Library. I embedded the report's designer on a TpageControl and I added buttons and other components to the form so that I can interact from Delphi to the report's designer and add components to the report or modify their properties.

the problem I am having is that I need to know when the user selects (Clicks) a component in the report so that I show the correct properties for the component type that was selected. and I already asked on the fastreport support but there is no such event or any way the report notifies when it happens.

so, my question, is there any way to set a general on click event or something similar that lets my form know that the mouse was clicked, no matter where or what the user clicked but to be notified about the action itself of clicking.

I already tried setting the OnMouseDown event for the TTabSheet where the report's designer is embedded but It doesn’t trigger anything.

if it helps, I have my form and the TJvWizard in it, the wizard has some JvWizardIneriorPage and in one of those is my TPageControl which has two TTabSheet and I embedded the designer in one of those.

Edit: in This other question provided by Sertac in the comments I found what I needed.

Hiram
  • 159
  • 1
  • 9
  • No, if the control itself doesn't give you this functionality, you are essentially out of luck (there are solutions, but only *very* awkward ones, which are *very* unlikely to work well). – Andreas Rejbrand Jun 21 '19 at 16:08
  • @AndreasRejbrand, is there any other option that might be helpful? like move the mouse over or anything else? – Hiram Jun 21 '19 at 16:17
  • With an application onmessage event handler (applicationevents) you may observe all mouse down/up messages and filter them for a specific form's window. Mouse down/up is **not** (*) the same thing with a click though, so I can't tell if it would be any help to you. ( * The text in the question suggests you might be missing the difference between a mouse click and a control click). – Sertac Akyuz Jun 21 '19 at 16:37
  • @SertacAkyuz mouse down would probably Help, would you please point me in the right direction to achieve that? or maybe show some demo code? and you are right, I don't really know the difference between mouse click and control click. – Hiram Jun 21 '19 at 16:47
  • 1
    I think you can start from [here](https://stackoverflow.com/questions/47843847/logging-application-wide-mouse-clicks-in-delphi), by searching you'll find more. – Sertac Akyuz Jun 21 '19 at 16:56
  • Thanks, I'll look into it. – Hiram Jun 21 '19 at 17:00
  • Any solution that doesn't involve the control itself is likely to be very fragile. For instance, you might know that on *your* system, a particular part of the report starts at coordinates (100, 120) *under some circumstances*. But on a different system, or under different circumstances, the control might well start at (100, 130) or (150, 180) or (200, 240) or (80, 120). And in the next version of FastReport, ... (High DPI is just one thing to consider.) – Andreas Rejbrand Jun 21 '19 at 17:24
  • @AndreasRejbrand and isn't there any other option to get the clicked object instead of coordinates? – Hiram Jun 21 '19 at 17:43
  • One wonders if you have not looked at the code in the question in the link I posted... – Sertac Akyuz Jun 21 '19 at 17:58
  • Are the objects windows (do they have HWNDs)? You can use WinSpy++ to find out. If not, if everything is painted manually by the Fast Report control, you are out of luck. – Andreas Rejbrand Jun 21 '19 at 17:59
  • @SertacAkyuz, I was just doing so, and it solves that problem, in fact I think it is exactly what I need. I am doing some tests and I'll let you know if it worked. – Hiram Jun 21 '19 at 18:00
  • There are a couple of options here. 1. You could have a transparent overlay on top of everything and put the OnClick on that. 2. You could run through all of the controls and hook up the OnClick event. – Graymatter Jun 21 '19 at 21:30

0 Answers0