Hello,
I would like to be able to create an assistant via code. The reason being that we have MANY different projects and that they should all share the same configuration. To that end, I have written common initialization code for configuring madExcept. The only thing I am now missing (and can't seem to find out) is how I can add an assistant template.
The reason why I need to create a template is that I just want the detailForm form to show, nothing else and there is no existing assistant that does this.
Is there any solution?
Assistant creation via code
Re: Assistant creation via code
The current assistant solution is designed to be configured at compile time.
Anyway, you can experiment with using the following function exported by madNVAssistant.pas:
And then you can use "INVAssistant.ShowModal()" to actually display the assistant. You can check madExcept.pas to see how madExcept uses these functions.
However, usually madExcept creates and shows the assistants automatically, as part of the exception handling. If you want to manually create custom assistants, you'll have to show them manually, as well, e.g. within a RegisterExceptionHandler() or RegisterExceptActionHandler() callback.
Maybe it would be easier to already prepare/create the assistant you need, and then use it for all your projects? There's a trick to have all your projects use the same mes file:
1) Create a proper *.mes file with the exact configuration you want.
2) Store this *.mes file in a "global" folder.
3) Using Notepad.exe create a "forward.mes" file which contains one line of text which is the file path/name of the global mes file.
4) Copy this "forward.mes" file to all your projects and rename it to match your project names.
This way all your projects will use the central/global mes file. Maybe that helps?
Anyway, you can experiment with using the following function exported by madNVAssistant.pas:
Code: Select all
function LoadAssistant (module : HMODULE;
const title : UnicodeString;
const forms : array of UnicodeString;
const exception : IUnknown = nil) : INVAssistant;
However, usually madExcept creates and shows the assistants automatically, as part of the exception handling. If you want to manually create custom assistants, you'll have to show them manually, as well, e.g. within a RegisterExceptionHandler() or RegisterExceptActionHandler() callback.
Maybe it would be easier to already prepare/create the assistant you need, and then use it for all your projects? There's a trick to have all your projects use the same mes file:
1) Create a proper *.mes file with the exact configuration you want.
2) Store this *.mes file in a "global" folder.
3) Using Notepad.exe create a "forward.mes" file which contains one line of text which is the file path/name of the global mes file.
4) Copy this "forward.mes" file to all your projects and rename it to match your project names.
This way all your projects will use the central/global mes file. Maybe that helps?
-
- Posts: 19
- Joined: Tue Jul 17, 2018 9:21 am
Re: Assistant creation via code
Thank you for your answer.
I will try that, but honestly, I'd much rathed be able to configure madExcept completely vial code: much less room for error that way.Maybe it would be easier to already prepare/create the assistant you need, and then use it for all your projects? There's a trick to have all your projects use the same mes file:
1) Create a proper *.mes file with the exact configuration you want.
2) Store this *.mes file in a "global" folder.
3) Using Notepad.exe create a "forward.mes" file which contains one line of text which is the file path/name of the global mes file.
4) Copy this "forward.mes" file to all your projects and rename it to match your project names.