cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Customized Menu Removed after Initiating the "set stylesheet=" command

TimothyPedersen
1-Visitor

Customized Menu Removed after Initiating the "set stylesheet=" command

Arbortext Editor 5.4 M110

Background:

  • Menu customization is implemented using ACL and loaded at runtime from the [editor root]\custom\editinit\ folder.
  • The menus are not visible unless a document with the designated doctype is opened.
  • I am new to Arbortext Editor development.

Context:

  • Attempting to write ACL service that will allow content authors to change the FOSI style sheet form the current document "edit" window.
  • Using the ACL command "set stylesheet=fosiname.fos"

Issue:

When the "set stylesheet" command it initiated, the custom menus are removed.

Any idea what is happening? Or what I need to do to reload the menus?

Thank you in advance

7 REPLIES 7

Have you reviewed the menuloadhook?

Here is an example;

package testmenuhook

function testmenuhook_addmenus(win=0,filename="")

{

# add some menus to the Tools button

if (menu_exists('.Tools') && !menu_exists('.Tools.Export_XML'))

{

menu_add .Tools. "" -separator

menu_add .Tools. "Export XML" -cmd {eval "here's export_xml"}

menu_add .Tools. "Import XML" -cmd {eval "here's import_xml"}

}

}

missed the last 3 lines resubmitting.

Here is an example;

package testmenuhook

function testmenuhook_addmenus(win=0,filename="")

{

# add some menus to the Tools button

if (menu_exists('.Tools') && !menu_exists('.Tools.Export_XML'))

{

menu_add .Tools. "" -separator

menu_add .Tools. "Export XML" -cmd {eval "here's export_xml"}

menu_add .Tools. "Import XML" -cmd {eval "here's import_xml"}

}

}

#set up menus

add_hook("menuloadhook","testmenuhook::testmenuhook_addmenus")

testmenuhook_addmenus()

Hi Tim,

First let me thank you for responding to my question. Now to answer your question.

Not sure what you mean by;

>"Have you reviewed the menuloadhook?"

Background:

The custom menus established with the "menu_add" method and with the "add_hook" method is currently in the ACL stored in location "[editor root]\custom\editinit\" and is loaded at startup. I am writing a different tool that is also stored in this ACL file that allows the end-user to change the FOSI style sheet using the "set stylesheet=" command. When this command is submitted, the custom menus established with the "menu_add" method and with the "add_hook" method are removed.

Questions:

  1. Are you suggesting I need to reload the menus with the "menu_add" method and "add_hook" method after submitting the "set stylesheet=" command?
  2. Is this common practice?
  3. Is there a way to reload the ACL in the "[editor root]\custom\editinit\" folder?

Thank you in advance


I was suggesting that you review the menuloadhook function documentation in Arbortext Editor Help Center - Help > Help Center.

Okay, I'll check it out. Thanks!

Hi Tim,

Thank you for directing me to the appropriate documentation to help resolve the issue I was having. I believe the best solution for my situation is:

  1. initial command "menu_save -all" (to save the "menu.cf" file to the document default folder).
  2. initiate command "set stylesheet=newfosifile.fos" (to change the FOSI).
  3. initiate command "menu_load menu.cf" (to set the menu back to the state when the menu_save command was initiated).

This seems to be working in my test case and I assume this is an appropriate method to achieve my goal?


Best Regards

Announcements

Top Tags