For my current problem I need some kind of WinClose event in Vim. I know that there is the WinNew event thrown when I split a window. The same I need for the :close command. In the list of events (:h autocmd-events) I couldn't find something like this reading the descriptions. Also if other pairs like TabNew & TabClosed or WinEnter & WinLeave are there.
So the idea is to track all events thrown in Vim and try to find out what event is thrown when closing a window like this.
Thanks for helping me!
vim v8.2.3591 added a WinClosed event.
Related
Suddenly had to finish the old project and ran into problem with keyboard input handling. I have a window with a list of items. I want to select an item by pressing the first few letters of its name on the keyboard, as it works in the Windows. Search on the Internet, unfortunately, did not give results.
I have this code for processing messages and events.
BEGIN_MESSAGE_MAP(CMyDialog, CDialog)
ON_BN_CLICKED(IDHELP, OnHelp)
ON_WM_SIZE()
END_MESSAGE_MAP()
BEGIN_EVENTSINK_MAP(CMyDialog, CDialog)
ON_EVENT(CMyDialog, SOME_ID, SOME_DISP_ID, SomeFunction, SOME_PARAMS)
END_EVENTSINK_MAP()
I would like to know if it is possible to add such functionality to it.
I would appreciate any help.
I would like to execute specific code when a window has been moved by the user clicking the window title decoration and dragging the mouse to a new position.
The command "wm protocol window ?name? ?command?" is used to manage window manager messages like WM_DELETE_WINDOW.
Trying the following code doesn't do anything when the window has been moved..
package require Tk
wm title . "move test"
wm protocol . WM_MOVE {puts "window has been moved!"}
It seems Tk doesn't know about the message WM_MOVE so it ignores it.
However catching the WM_DELETE_WINDOW message instead of WM_MOVE the above code works.
Am I missing something?
Is there another way to programmatically react on the change of a window's position?
Window positions should be reported via conventional events, i.e., <Configure> events. Try doing:
bind . <Configure> {puts x=%x,y=%y,width=%w,height=%h}
Then move and resize the . window; you should see events for each of these actions. Note that the events do not necessarily mean a move; a resize will also generate them. As with any binding on a toplevel, you should take care that it isn't being reported for one of its sub-widgets (look at %W to work that out). You may find that %X and %Y are better than %x and %y; experiment…
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()
I've ran into next mystic thing in Winapi/MFC, I have an edit box, contents of which I have to select on Tab, Lclick, Rclick, Mclick and so on.
The sort of obvious path is to handle the SETFOCUS message and call SetSel(0, -1), which should select all text. But it doesn't work!
What's wrong? I tried googling, everyone seems to override Lclilks or handle SetSel in parent windows, but this is wrong from encapsulation point of view, also multiple clicks (user wants to insert something in the middle of the text) will break, and so on.
Why isn't my approach working, I tried like 10 different ways, tried to trap all possible focus messages, looked up info on MSDN, but nothing works as expected.
Also, I need to recreate the carret on focus, which also doesn't seem to work.
SETFOCUS message gets trapped alright. If I add __asm int 3, it breaks every time.
It's the create carret and setsel that gets swallowed it seems.
Post the edit an EM_SETSEL while handling WM_SETFOCUS. The mouse input is probably processed after the focus switches. Or post a user message and on receiving create the caret and then do the selection.
I am writing an app with raw windows API (opensource Win32++) where I have a ListView.
The problem I have now is that whenever an item in the ListView is clicked, the system/app will generate a warning tone/sound "ding". Furthermore, I noticed I cannot get the LVN_ITEMACTIVATE through item-dbl-click or item-keypress-enter, which would normally work if this problem had not occur.
Would anyone have any idea how this might be happening?
I believe there is nothing wrong with Win32++, it just could be one of the things I do is causing this. But my program has become quite big to dissect plus I have no idea where to start looking.
Thanks.
PS: I had my computer muted for the longest time, hence, I don't know when this started eventhough I had the listview since a long time ago. T_T
Start looking with a tool that can show you the Windows messages that the control generates and receives. Like Microsoft's Spy++. Compare it with a working list view to have an idea what might be amiss. Also check the parent window. I haven't otherwise heard of listviews that dingaling, the LVN_ACTIVATEITEM should fire the first WM_LBUTTONDOWN, no double-click necessary.