General XMetaL Discussion
XMetaL Community Forum › General XMetaL Discussion › Load XFT-Forms out of a XAC-file?
-
spyro May 29, 2009 at 1:48 pm
Load XFT-Forms out of a XAC-file?
May 29, 2009 at 1:48 pmParticipants 2Replies 3Last Activity 13 years, 10 months agoHi there,
How do I call a XFT-Form that's not accessable as a single file? The XMetaL-plugIn for Visual Studio delivers a all-in-one-package with the extension “.xac”. Internally it seems to be a ZIP with all needed files except the DTD (e.g. the MCR-, TBR-, CTM-, RLX-, CSS-file and all included XFT-forms).
While element-bound XFT-forms are loaded without problems it seems not possible to access them directly via a macro that is bound to a button.
The Code
[code]Set dlg=Application.CreateFormDlg(PATH/TO/FORM.xft”)
dlg.DoModal()
dlg=Null[/code]doesn't work because the XFT is packed inside the XAC-file and can't be accessed by the file system. So, how could I call this form anyway?
Thanks,
RupertDerek Read May 29, 2009 at 10:43 pm
Reply to: Load XFT-Forms out of a XAC-file?
May 29, 2009 at 10:43 pmThe XAC file is extracted before use by XMetaL Author and XMAX (at which point they read in all the files they contain pretty much as if you had created an “old style” customization with the CSS, CTM etc sitting beside the DTD), so you can reference it there.
One way to do that is to use the API ActiveDocument.ResourceSet.Root to build the path, something like this:
[code]Dim xftPath, dlg
xftPath = ActiveDocument.ResourceSet.Root & “myform.xft”
dlg = Application.CreateFormDlg(xftPath)
dlg=Null[/code]Technically, the value of Root is the folder where the .ctm file is located.
The alternative is to not use the XAC file and deploy your customization as separate files (DTD/RLX/RLS/RLD, CSS, CTM, MCR, XFTs), which are also created when you do a build in addition to the XAC file. Note that in this case the only file that is actually “compiled” is the MCR file, the rest of the files (CSS, CTM, etc) are really just copied over unmodified. In this case the same API is often useful, because you still need to provide CreateFormDlg with a full path.
spyro June 2, 2009 at 10:47 am
Reply to: Load XFT-Forms out of a XAC-file?
June 2, 2009 at 10:47 amThank you! The solution with activedocument.ResourceSet.Root works like a charm.
Greetings,
Rupert Jungedward23 June 5, 2009 at 12:39 pm
Reply to: Load XFT-Forms out of a XAC-file?
June 5, 2009 at 12:39 pmYou can also add almost any other type of file to your project that you want; …… fxindex.htm files carry out the following basic steps: ….. Developer automatically creates a .xac file, which you can then copy using a …. For more information on how to use these methods to load
-
AuthorPosts
- You must be logged in to reply to this topic.