3

When I embed a form within other forms, a TEdit on this form loses its ability to use Ctrl+C to copy its text. Ctrl+V still works, as does Ctrl-Ins (copy) and Shift+Ins (paste). When I use the form on its own, e.g. modal, Ctrl+C works fine. So, I'm fairly sure that in the embedded form case the Ctrl+C is being consumed before it gets to the TEdit and Ive checked that I'm not using it as a shortcut in an action list. So, to dig deeper, could someone advise me of a good debugging procedure for observing Ctrl+C and its lifetime?

mate64
  • 9,876
  • 17
  • 64
  • 96
Brian Frost
  • 13,334
  • 11
  • 80
  • 154
  • probably one the forms you are using has keypreview set to true, so the form handle CTRL+C – RBA Jan 17 '14 at 10:57
  • and to answer to your question you can use Spy++ http://msdn.microsoft.com/en-us/library/aa264396%28v=vs.60%29.aspx – RBA Jan 17 '14 at 10:59
  • 2
    You can put a conditional breakpoint after PeekMessage in Application.ProcessMessage. – Sertac Akyuz Jan 17 '14 at 11:52
  • What do you mean by embedding a form? `Form2.Parent := Form1;`? I don't believe something is consuming the message: from my experience it seems actually quite hard to prevent a message from reaching the active control. The only trustworthy way I've ever found is by setting `Handled := True;` in TApplication.OnMessage (or equivalent). That's why I would investigate if (and why) the message is not being dispatched to the correct (focused) control. I would probably start by debugging TApplication.ProcessMessage as suggested above. Is it possible to provide [SSCCE](http://sscce.org/)? – GabrielF Jan 17 '14 at 14:00
  • I tried to embed a form within another using the code by David H. here: http://stackoverflow.com/a/4386129/1970843 I've had problems (even with mouse clicks) whenever I tried to remove the `BorderStyle := bsNone` piece. I don't know how to debug any further, though. – GabrielF Jan 17 '14 at 14:14
  • @Sertac: Your suggestion is working fine - still have not found where it's going yet! – Brian Frost Jan 20 '14 at 10:13

0 Answers0