How to preserve key bindings in lister plugin

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
RoMa
Junior Member
Junior Member
Posts: 25
Joined: 2003-03-08, 11:38 UTC

How to preserve key bindings in lister plugin

Post by *RoMa »

I am develloping a lister plugin that is similar to the sample 'listplug.wlx'. The main difference is that my plugin does not create the rich edit window as a direct child to TC, but puts another window in between.
I am using this 'dummy' window in between, because i want to have a context menu.
The window procedure for the 'dummy' window that is TC's child looks like this:

Code: Select all

LRESULT CALLBACK DummyWndProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
    HWND RichEd = (HWND)GetWindowLongPtr(hwnd, RICH_ED_IDX);
    switch (Msg)
    {
        case WM_CONTEXTMENU:
            // show context menu
            return 0;

        case WM_COMMAND:
            // handle commands from context menu as well as notifications
            // from rich edit window
            return 0;

        case WM_SETFOCUS:
            SetFocus(RichEd);
            return 0;

        case WM_SIZE:
            MoveWindow(RichEd, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
            return 0;
    }

    return DefWindowProc(hwnd, Msg, wParam, lParam);
}
Most things are fine, but there is one thing that i don't like:
As soon as lister uses my plugin, all of listers key bindings (like 'F7' for search or '3' for hexadecimal view) stop working.

Is my code doing something wrong or do i have to live with that?

Ciao,
RoMa
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50479
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Lister subclasses the window which you return in ListLoad. This way it can catch these key messages. What you can do is subclass the rich edit window yourself, and forward all WM_KEYDOWN, WM_KEYUP and WM_CHAR messages with PostMessage to your parent window (not to lister) so lister can see them.
Author of Total Commander
https://www.ghisler.com
User avatar
RoMa
Junior Member
Junior Member
Posts: 25
Joined: 2003-03-08, 11:38 UTC

Post by *RoMa »

Thanks for the hint. It 'just works®' :-)
Post Reply