Question on overriding dialogs.
I've been doing some compatibility work between AutoCAD and Bricscad in C++ and ran into something I can't seem to find in the API.
In AutoCAD I am able to register a callback for the File->New/Open/Save/SaveAs dialogs like so :
acdbHostApplicationServices()->registerSelectFileCallback(_T(" AdskFileNew "),(SELECTFILEPROC)SelectFileCB, false, true);
Now, when I compile this in straight AutoCAD(2008/2009), it compiles and callback fires when I hit the dialog. However, in Bricscad it compiles fine but the callback is never called.
Does anyone know if this is a supported function in Bricscad? If it is, is there something I'm missing?
Thanks,
-Eric
Comments
-
Dear Eric,
this kind of callback is not supported ... but the function is implemented at
acdbHostApplicationServices() for compatibility reasons.
The question is, why you need such a callback from file selection dialog ?
If you need to know when a dwg/dxf file is opened, you can also use AcEditorReactor
and its events to get notifications.0 -
Thanks for the reply,
Currently I use the callback to re-route any new and qnew calls through an entirely different process. I also use it to do some checks on the filepath from any open calls for validation before allowing the open to continue.
I've never really used reactors, but I won't be able to halt the execution of a command using a reactor will I?
-Eric
0 -
Dear Eric,
you are right - using reactors you can only monitor the event,
you can not block it ...
Nevetherless, that FileDialog hook will only work in interactive mode,
so what about (command "_open" filename) ?? :-)
This will completely bypass your hook, also, there are many other
ways to open an existing/new drawing (via COM by Lisp + VB/VBA etc.).
What you might do is to undefine OPEN and NEW commands, and provide
your own implementation in your code ...
For sure, this will also not be safe regarding alternate ways to open a file;
but at least, you have your own OPEN and NEW
(in example, you can use your own FileSelection dialog, with any kind of hooks,
www.CodeGuru.com provides dozens of good samples for).
Maybe this is a kind of approach ?
Many greetings, Torsten0