Kevin Flynn wrote:
> I am trying to make some simple changes to the XXE user interface for a
> particular document (let's call it mydoc). The following xxe_gui file:
>  
> <?xml version='1.0' encoding='UTF-8'?>
> <gui xmlns="http://www.xmlmind.com/xmleditor/schema/gui";
>      xmlns:gui="http://www.xmlmind.com/xmleditor/schema/gui";>
>  
>   <include location="xxe-gui:app/default.xxe_gui" />
>  
>   <action name="mydocSaveAction" label="_Save"
> icon="xxe-gui:app/icons/saveAction.gif" accelerator="mod S">
>     <context editingContextSensitive="false">
>       <configuration name="mydoc">
>    <command name="mydoc.save"/>
>    </configuration>
>       <default>
>          <class>com.xmlmind.xmleditapp.kit.part.SaveAction</class>
>       </default>
>  </context>
>   </action>
>  
>   <action name="mydocCloseAction" label="_Close"
> icon="xxe-gui:app/icons/closeAction.gif" accelerator="mod shift W">
>     <context editingContextSensitive="false">
>       <configuration name="mydoc">
>    <command name="mydoc.close"/>
>    </configuration>
>       <default>
>   <class>com.xmlmind.xmleditapp.kit.part.CloseAction</class>
>       </default>
>  </context>
>   </action>
>  
> <menu name="fileMenu" label="_File" helpId="fileMenu">
>    <action name="newAction"/>
>    <action name="openAsTemplateAction"/>
>    <action name="openCopyAction"/>
>    <separator/>
>    <action name="openAction"/>
>    <separator/>
>       <action name="mydocCloseAction"/>
>    <separator/>
>    <action name="mydocSaveAction"/>
>    <action name="saveAsAction"/>
>    <action name="saveCopyAction"/>
>    <separator/>
>    <action name="pageSetupAction"/>
>    <action name="printAction"/>
>    <separator/>
>    <action name="quitAction"/>
>    -

Please remove this "-". It makes your custom.xxe_gui invalid (but this
has nothing to do with your problem).

>   <!--
>     No need to add a separator here. Separator is dynamic too.
>    -->
>    <menuItems name="recentFilesMenuItems"/>
> </menu>
>  
> <menu name="windowMenu" label="_Window" helpId="windowMenu">
>  <action name="precedingWindowAction"/>
>  <action name="followingWindowAction"/>
>  <menuItems name="windowListMenuItems"/>
> </menu>
>  
>   <layout>
>     <insert />
>   </layout>
> </gui>
>  
> is intended to:
>  
> -  remove  the Save All and Close All functions
> -  move the Close function from the Window menu to the File menu
> -  redefine the actions of SaveAction and CloseAction for mydoc documents.
>  
> Suppose that the definitions of mydoc.save and mydoc.close in the XXE
> configuration file are:
>  
>   <cfg:command name="mydoc.save">
>     <cfg:macro>
>         <cfg:sequence>
>           <cfg:command name="alert" parameter="Saving file" />
>          <cfg:command name="XXE.save"/>
>        </cfg:sequence>
>     </cfg:macro>
>   </cfg:command>
>  
>   <cfg:command name="mydoc.close">
>     <cfg:macro>
>         <cfg:sequence>
>           <cfg:command name="alert" parameter="Closing file" />
>           <cfg:command name="XXE.close"/>
>        </cfg:sequence>
>     </cfg:macro>
>   </cfg:command>
>  
> The Save function works (an alert is displayed, then the file is saved).
> The Close function doesn't (an alert is displayed, then nothing
> happens). Why does the Close function not work?

It does not work simply because there is no longer a command called
"XXE.close".

Command "XXE.close" is implemented by the standard "closeAction" action.

Standard "closeAction" action is *declared* in
"xxe-gui:app/default.xxe_gui", but it is not *created* during XXE
startup. This, because it is not referenced directly or indirectly by
the "layout" element.

If you rewrite your "layout" element like this:

---
  <layout>
    <hidden>
      <insert />
      <action name="saveAction" />
      <action name="closeAction" />
    </hidden>
  </layout>
---

It will work.

---
PS: Now, why did "XXE.save" exist (and therefore works) and not "XXE.close"?

Answer: Command "XXE.save" is implemented by the standard "saveAction"
action. The standard "saveAction" action is referenced in the standard
*toolBar* (which is not the case of "closeAction") which itself is
referenced in the standard "layout" element.

---
PS2: This means that you need to redefine the standard "toolBar" as well.

---
PS3: There is currently no way to force the (X) icon found in the active
document tab to invoke your custom "mydoc.close". This is actually a
deficiency of our design.






Reply via email to