Hi everybody,
It has come to my attention that setting up DocView as an external tool has some problems. User calls DocView to display help via keyboard shortcut, but DocView is never displayed. If you look in the Task Manager, DocView is running, but not visible. This issue is in Lazarus, as far back as v0.9.26.2 and still applies to v0.9.29 as well.
This is caused by a bug/oversight in Lazarus IDE and External Tool handling. The easiest work-around is to do the following:
1) Create a "docview.cmd" file, and insert the following commands inside that text file.
-------------[ docview.cmd ]---------------------- start c:\path\to\docview.exe c:\path\to\INF\docs\ -k "%1" --------------------[ end ]-----------------------
2) Then change your DocView external tools setup to not run docview.exe directly, but rather to run the docview.cmd file instead.
In the External Tools > Edit Tool dialog
Program filename: C:\path\to\docview.cmd
Parameters: $CurToken()
3) DocView will now run! :)
The problem is specific to Lazarus IDE running under Windows. The cause is due to line 344 in the unit ide\exttooldialog.pas
Code:
TheProcess.ShowWindow := swoHide;For some reason the Lazarus developers thought it useful to hide the main form of ALL external tools. This might be handy for console apps, but for GUI apps that adhere to Win API rules, that's not so good. You can simply comment that line and recompile Lazarus IDE to fix the issue, or apply the easy work-around shown above.
Thanks to frost_asm from the Lazarus Forums for supplying the work-around tip.
I have created a patch for Lazarus v0.9.29 to solve this problem, by making that offending TProcess option user selectable in the Edit External Tools dialog. The patch is available at:
http://bugs.freepascal.org/view.php?id=17312
Regards,
- Graeme -
