[Development] External WLX plugins loader

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

Moderators: Hacker, petermad, Stefan2, white

User avatar
Alextp
Power Member
Power Member
Posts: 2321
Joined: 2004-08-16, 22:35 UTC
Location: Russian Federation
Contact:

Post by *Alextp »

ListLoad function description
Remarks:

Please note that multiple Lister windows can be open at the same time! Therefore you cannot save settings in global variables. You can call RegisterClass with the parameter cbWndExtra to reserve extra space for your data, which you can then access via GetWindowLong(). Or use an internal list, and store the list parameter via SetWindowLong(hwnd,GWL_ID,...).

Lister will subclass your window to catch some hotkeys like 'n' or 'p'.

When lister is activated, it will set the focus to your window. If your window contains child windows, then make sure that you set the focus to the correct child when your main window receives the focus!
poiuytr, do you know what does first red selction mean?
Do I need to "subclass" plugin window in my loader?
How to do it?

And 2nd selction: do I need to put focus on plugin window?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50421
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Do I need to "subclass" plugin window in my loader?
Only if you want to react to keys like 'n' or 'p' to jump to next/previous file.
do I need to put focus on plugin window?
Yes, just use SetFocus().
Author of Total Commander
https://www.ghisler.com
User avatar
Alextp
Power Member
Power Member
Posts: 2321
Joined: 2004-08-16, 22:35 UTC
Location: Russian Federation
Contact:

Post by *Alextp »

2ghisler(Author)
The main problem with plugins keys handling is: when plugin (e.g. SynPlus.wlx) is started, it doesn't react to arrow keys (but reacts to PgUp/PgDn). The same is with office.wlx. It seems my form gets arrow keys before plugins, and plugins don't. Is the problem in subclassing?

My code below.

Code: Select all

//New window proc
var
  fOrigWndProc: TFNWndProc = nil;

function fNewWndProc(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
begin
  //What code here?
  //
  Result:= CallWindowProc(fOrigWndProc, hWnd, Msg, wParam, lParam);
end;


//Subclassing
...
  Longint(fOrigWndProc):= SetWindowLong(HWnd, GWL_WNDPROC, Longint(@fNewWndProc));

  SetParent(HWnd, FParentForm.Handle);
  SetFocus(HWnd);
...
Form.KeyPreview doesn't help.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50421
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

You are right, I have KeyPreview set to ON. In FormKeyDown, I check for vk_up, vk_down etc. and send WM_VSCROLL to my own window. However, I checked in the debugger but none of my functions is called while SynPlus is active!

I suggest that you send your tool to the SynPlus author and ask him why it doesn't work...
Author of Total Commander
https://www.ghisler.com
User avatar
Alextp
Power Member
Power Member
Posts: 2321
Joined: 2004-08-16, 22:35 UTC
Location: Russian Federation
Contact:

Post by *Alextp »

2ghisler(Author)
In FormKeyDown, I check for vk_up, vk_down etc. and send WM_VSCROLL to my own window.
So if I don't do vk_up/ vk_down/ etc handling in FormKeyDown, plugin keys will not work? Can they work wihtout this handling?

Small note: keys become working in plugin after I show/hide other controls (not plugin) on Viewer form. But they don't work immeidately after Viewer start.
I suggest that you send your tool to the SynPlus author and ask him why it doesn't work...
SynPlus author is not resp. for this problem, because the same problem is with office.wlx and my own OOView.wlx...
User avatar
Alextp
Power Member
Power Member
Posts: 2321
Joined: 2004-08-16, 22:35 UTC
Location: Russian Federation
Contact:

Post by *Alextp »

2poiuytr
The same problem with arrow keys (see my post to Ghisler) is with your WLX loader. Can you help?
poiuytr
Senior Member
Senior Member
Posts: 243
Joined: 2003-02-23, 17:33 UTC

Post by *poiuytr »

Alextp wrote:2poiuytr
The same problem with arrow keys (see my post to Ghisler) is with your WLX loader. Can you help?
I can't figure out why it happens (focus jumps to my form when arrow keys pressed and I can't catch the trigger of this behaviour), but I found a condition for arrow keys to work as expected.
Just be sure that there are no focusable controls on your form. Personally I make all controls disabled and arrows works as expected inside plugins. Changing TabStop to false don't help here.

edit:
Oh yeah, there are sources in case you wanna try them.
Last edited by poiuytr on 2006-07-08, 16:58 UTC, edited 1 time in total.
User avatar
Alextp
Power Member
Power Member
Posts: 2321
Joined: 2004-08-16, 22:35 UTC
Location: Russian Federation
Contact:

Post by *Alextp »

2poiuytr
Can I just hide contorls, without disabling?
I hide them all when plugin activated, but arrows don't work.
poiuytr
Senior Member
Senior Member
Posts: 243
Joined: 2003-02-23, 17:33 UTC

Post by *poiuytr »

Well, in my case focus shifts to controls on my form when I press arrow key. What happening with your app?

p.s. hiding also works (in my case), as I stated above making controls unfocusable do the job.
User avatar
Alextp
Power Member
Power Member
Posts: 2321
Joined: 2004-08-16, 22:35 UTC
Location: Russian Federation
Contact:

Post by *Alextp »

2poiuytr
I found it! It was Viewer (component instance of type ATViewer) focused. Form has ActiveControl=Viewer, I just cleared this prop and all works now.

Thanks for hint!
poiuytr
Senior Member
Senior Member
Posts: 243
Joined: 2003-02-23, 17:33 UTC

Post by *poiuytr »

Yeah, clearing of ActiveControl property helps me also. Much better then disabling/hiding :)
User avatar
Alextp
Power Member
Power Member
Posts: 2321
Joined: 2004-08-16, 22:35 UTC
Location: Russian Federation
Contact:

Post by *Alextp »

Another question:
when to put focus on plugin window. Of course, after ListLoad(). When else? E.g., we call some dialog ("Find text" in my Viewer) and plugin looses focus. So, we need to put focus explicitly after every dialog show? Not nice, there may be 20+ dialogs... Maybe, some better way can be, like changing focus in event handler?

How Christian do this?


----

2poiuytr
Are you Dmitrie Murzaikin, author of Tiny TC Restarter? :)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50421
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Yes, when lister gets a WM_ACTIVATE (with paramters "activate"), and a plugin is active, it sets the focus to the plugin window. You will need to do the same.
Author of Total Commander
https://www.ghisler.com
User avatar
Alextp
Power Member
Power Member
Posts: 2321
Joined: 2004-08-16, 22:35 UTC
Location: Russian Federation
Contact:

Post by *Alextp »

2ghisler(Author)
It helped, thanks!
User avatar
majkinetor !
Power Member
Power Member
Posts: 1580
Joined: 2006-01-18, 07:56 UTC
Contact:

Post by *majkinetor ! »

Alex, can this be downloaded somewhere. I always thought... why Viewer hold that ATView Delphi component when we all use some plugins for images and other popular formats....

This is the right thing to do... Excellent work. Don't forget to copy/paste the interface we did for the full Viewer.

Now, if Ghisler refuse to update API, this can be implemented:
Make a screen capture of lister and display it as a bitmap which is then hidden after the next plugin has loaded
Habemus majkam!
Post Reply