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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

menu_add using -active

ebheadrick
1-Visitor

menu_add using -active

Hi all,

Now that you are all back from the conference I can start asking questions again 🙂

I am able to get my menu item added to the menu and the cmd is getting called like I want... but I haven't figured out the -active option so that the menu item is only active when the user isin a table or if they have selected the table.

# *** Add table styles menu ***
menu_add ".Table." "Change Table Style" -cmd {jepp_tabledlg::change_jepp_table_dlg();} -active "tbl_mod_table_dlg()"
# table==oid_name(selected_element())
# selected() this is if any text is selected in the edit window

I guess I learn by example and just haven't found any examples of something like this. 🙂

Ellen

1 REPLY 1

Hi, Ellen...

The key is to have a function you can call that will return a 1 if the
option should be enabled or a 0, otherwise.

I find that the best examples are in the product, itself, as Editor
comes with lots of ACL code that provides many of the out-of-the-box
features. Looking at Editor\lib\editmenu.cf, which defines the
default menus, most of the entries in the Table menu have -active
options. The functions called by these are mostly in
Editor\packages\main\_tblnav.acl.

You might be able to use one of these as-is, though since they're
undocumented, this could break if you upgrade to another version
later. Looking at these functions (most of them are reasonably short)
may give you some ideas about how to use the documented ACL table
functions to write your own.

-Brandon 🙂


Announcements

Top Tags