Can't Find the Calling Function - debugging

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?

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.

Related

How to get the hot item name and path from Explorer?

It was easy when the Windows' explorer was using a SysListView32 control for displaying its files list as opposed to the DirectUIHWND control in the subsequent versions of Windows after XP.
A simple task such as obtaining the 'hot item' which is that item (a filename) the mouse hovers above for some hundreds of milliseconds, where before I could use the macros
ListView_GetHotItem with ListView_GetItemText and be able to obtain the filename under the mouse cursor.
This simple task becomes almost impossible to do with the DirectUIHWND window unless I revert this control back to a
SysListView32 which I have seen being proposed as the only solution on the many sites I have searched, and even if used the change does not occur immediately but only after I navigate out of the folder first.
It has taken me almost 2 years trying to find a solution to this and until now I feel stumped.
Anyone any idea please ?
Basically I have subclassed the parent of the tooltip and intercepted the tooltip notifications and all I need is the filename and the full path of the item the mouse hoovers above it, the hot item.
https://learn.microsoft.com/en-us/archive/msdn-magazine/2000/march/windows-2000-ui-innovations-enhance-your-user-s-experience-with-new-infotip-and-icon-overlay-shell-extensions
IQueryInfo is required to provide the runtime text to the shell. IPersistFile is used by Explorer to let the extension know about the specific file currently under the mouse pointer.

Drag and Drop( ctrl+drag) Problems in Xcode

There are two places within Xcode (version 13.3) where I can't drag and drop anymore.
Trying to move a file to a Group. I have tried just clicking and dragging, control-click, option-click, command-click, none work. Instead of dragging the file, the cursor just moves without the selected/highlighted file and highlights whatever file or group it is hovering over.
Trying to drag a button to a View Controller to make a connection. Instead, a popup window appears with three rows, each with corresponding icon, two lines each (title and object type): View Controller, View, Button. (I can't figure out how to capture that screen since I am already holding the control key and mouse button (track pad) but here is a photo.
Update:. All works fine when using a mouse but these two problems always exist when using the trackpad. I did discover that by pressing the Escape key, I can perform the control-drag (but not move files). I have played with the trackpad settings but have not yet been able to figure out how to get rid of that window that appears.
This popup appears whether I am holding the control, option, or command key.
What xcode version are you using, just tried
#1 is working as expected on my xcode13.0
#2 seems to be working for me too..

AHK Cannot ControlClick on hidden elements in nested child window

I'm trying to automate a many clicking process, just to narrow it to the user input.
I encountered problems in controlClicking interface elements, which seems not to be standard Windows GUI elements.
When pointing them with WinSpy they don't appear as separate buttons, but I can point the whole child Window which is drawn in the main program window.
As on pic1, I pointed the whole window and I can find each tab/button by it's text inside and on pic2 I can inspect the ClassNN of that element and it's ID.
As far as clicking other buttons in the main menu bar of the program works, a simple:
ControlClick, ClaTab_01000000H26, WindowName
doesn't work. I think during the day, and many possibilities I tried, I could ControlClick the above button by pointing it with its ID, but that ID changes every instance. I could confirm that tomorrow if it works by ID.
Of course I tried SetControlDelay -1 and ,NN option. But don't take that for granted, I can try any of your suggestions tomorrow.
Both tabs marked with purple color, are to find in the Windows->SiblingWindows tab. I really don't want using x,yCoords (that actually work), but I need the script to be as reliable as possible.
So my questions are:
Am I missing something or you have any suggestions how to click that elements?
Is it correct, that no matter how deep the child windows get (one has buttons to open another on top of it), all the time the WinName stays the same pointing to the main program ***.exe?
Could you provide an example from the web or yours, to find an element's ID by providing the text attached to the button (pic1-red line and also pic2 in "text")?
I also cannot maximize the child window. Double clicking it works, but I can't find the appropriate ClassNN of the window to call.
Could you provide an example, how to use the Messages tab? I assume, if I find the button as on the pictures, I could send a message with controlClick and see if there's a reaction?
1.Ugh. I found the solution, which is awesome, but a little frustrating that with a bit of luck I tried another aproach that's not that logical for a newbie like me:
instead:
ControlClick, ClaTab_01000000H6, ahk_class ClaWin01000000H_2,,,, NA
it's just
ControlFocus, ClaTab_01000000H6, ahk_class ClaWin01000000H_2,,,, NA
2._Yep. One child window creates another and another and another, but winTitle stays the same. In my case:
ahk_class ClaWin01000000H_2
3._Code below returns the handle/ID of the element you specify. Change ClaTab and ClaWin to your chouice.
ControlGet, OutputVar, hwnd,, ClaTab_01000000H1, ahk_class ClaWin01000000H_2
MsgBox, %OutputVar%`
Probably to be continued.
I highly recomend to both use
WinSpy https://www.autohotkey.com/boards/viewtopic.php?t=28220
SimpleSpy https://www.the-automator.com/downloads/simple-spy/
First one has lots of useful information and the window tab provides information of hidden buttons/windows. Second one in a more clear way indicates the parent window and its class.

wxWidgets pprogrammaticaly move to next input control

I originally had code that set the focus to the first widget in a dialog, in the onInit method. But there were problems with it: if I pressed TAB, indeed focus moved to next control (wxTextCtrl), which got the blue 'focus' color, but the 'focus' color/highlight was not removed from previous focus widget. So now it looked like both first and second control had focus at the same time...
When cycling manually (by pressing TAB) full circle (till last control and then wrap around to the first), suddenly all worked well. That is, when moving focus from first control to next one, the first visually lost focus (blue color was removed) as it should. From now on, only one item had the focus color/highlight.
So instead of setting focus on the first control, I tried a different approach: I set the focus to the last control in the dialog, which is always the OK button. Next, I want to emulate programmatically that a TAB is pressed and received by the dialog. So I wrote this (inside Dialog::onInit):
m_buttonOK->SetFocus();
wxKeyEvent key;
key.SetEventObject(this);
key.SetEventType(wxEVT_CHAR);
key.m_keyCode=WXK_TAB;
ProcessWindowEvent(key);
Now the focus indeed moves away from the OK button, but it does not wrap around to the first control.
Only when I manually press TAB after the dialog opened, the first item gets focus.
Question: why does this wrapping around to set focus on first widget not work with the code shown above?
First of all, your initial problem is almost certainly related to not calling event.Skip() in one of your event handlers, see the note in wxFocusEvent documentation.
Second, you can't send wx events to the native windows, they don't know anything about it. In this particular case you can use wxWindow::Navigate() to do what you want, but generally speaking what you're doing simple can't, and won't, work reliably.

Click event is not firing in PowerBuilder on single line edit control

In child window of my application, I have placed one single line edit control named as sle_name. Its tab order is 1.
Below that control I have placed DataWindow having formatted as free form style.
When I run the app, if my focus is in sle_name, and I click on sle_name then rbuttondown event is triggered. Then I move my focus to DataWindow(dw_account). Once I got focus on dw_account and then if I try to click on sle_name, my focus is not moving on sle_name and neither I can run rbuttondown event on sle_name.
What is the reason for this problem?
One more thing: when I start this window my focus in set in sle_name, from that control if I press tab key then my focuse moves to dw_account and if I press again shift+tab then my focus is moved back to sle_account.
But if I try to set focus from dw_account to sle_account using mouse pointer it is not moving focus.
What is the reason behind this behaviour?
I had the same behavior in a child window.
It was fixed when disabled the 'ControlMenu' and 'TitleBar' properties in the window. (It's so strange).
Hope it helps
Juanma
This isn't natural behaviour, so the cause is likely something you've scripted. Depending on your architecture, the culprit code could be a number of places (e.g. framework objects). If this were my problem, I'd run with the PBDEBUG trace turned on (a System Option in the IDE, or /PBDEBUG on the command line after the deployed EXE name), and see what is firing when you try to move back to the SLE.
I'd also be using PBL Peeper to see the trace and the code side-by-side, so it's easier to see what code is being executed (the trace only shows you script name and line number).
Good luck,
Terry.
you must have to create the event ID pbm_lbuttonup, with the same parameter as rbuttondown event. Then in the code you write this.setfocus()

Resources