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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Working with menus, ACL and javascript

pzorrilla
1-Newbie

Working with menus, ACL and javascript

Hi Adepters 😃

I've been working with ACL, java and javascript in order to customize my
Arbortext environment, however in the meantime I've found a big problem,
and I'm still don't get to solve it. Inside my custom folder,
specifically inside my init folder I've created an acl file, in which I
define a menu_add command (menu_add -menu -before ".Tools" "Test").
However when I run Arbortext nothing happens =( and I don't now why,
because if I execute the command on the command window inside Arbortex
menu is created. I have been looking an option with javascript, but I'm
not sure how could I get it with javascript.

So please, if anybody knows the reason of my results, I would really
appreciate your help. Also I have been thinking that maybe I have to
configure something before but I'm not sure.

As always I am pretty grateful for your help and support,
Paulette Z
3 REPLIES 3

Hi Paulette--

The problem is that your code is running before the window exists, so there's nothing to add the menu to.

The usual way to handle this is to put menu modifying code inside a function, and then add that function as a menuloadhook. You can find documentation on this in the Help Center.

--Clay


Clay Helberg
Senior Consultant
TerraXML

On that note, here's a small javascript we keep in our custom\init folder
for just that reason:

/**
* This function loads the initial XUI.
* ApplicationLoad event is used because first run will
* not have a valid document (editinit) and scripts in
* init are called before the window is fully available.
*/
function handleEvent(e) {

if (e.getType().equals("ApplicationLoad")) {
// Put your menu creation code, or a call to it here
}
}
var o = { handleEvent: handleEvent };
var listener = Packages.org.w3c.dom.events.EventListener(o);
Application.addEventListener("ApplicationLoad", listener, true);


Thank you all for your replies, finally I created a new acl file and I worked with add_hook and menuloadhook, and defined a function in order to set my menus 😃


I really appreciate your help and support.

Announcements

Top Tags