I'm running C Builder 11.2, modifying an old program with a Form that contains a TImage
and a TBitBtn
(I first wrote the program 10 years ago, so I don't remember all of its details). A routine copies the Picture
in the TImage
to the Clipboard when the button is clicked.
The problem: The copy routine is also called when the mouse pointer is over the TImage
and the C key is pressed. But I can't find the code where the mouse status and pressing the C key cause the copy routine to be called.
Can the debugger tell me what code is calling the copy routine?
Could the mouse-over-TImage condition and C key press be established outside of the normal code, such as somewhere in the Object Inspector?
This is the entire call stack for the problematic case:
I assume the numbers are addresses. How do I associate those with lines of code in my program?
CodePudding user response:
This is a subtle problem that I inadvertently stepped into. The button that is used to capture the image has caption "Copy Image". I wanted to add code that would allow the image to be copied by pressing a keyboard key.
So, in anticipation of that, I began by adding one line of code to the MouseEnter event when the mouse pointer is over the image. That changed the caption so that the "C" in Copy is underlined. (A single line in the MouseLeave event changes the caption back.)
I used an ampersand (&) to add the underline. This is exactly how shortcuts are added to menu items. So, without thinking about it, I had added the shortcut that allowed the 'c' key to invoke the Copy Image button.