In reply to Andrew Beckett:
do you mean that we can't load the user defined menus in ADE by modifying the .cdsinit file directly?
In reply to imagesensor123:
No, I didn't say that. You can either use a menus file (which wouldn't be done via the .cdsinit), or using:
envSetVal("asimenv.startup" "sessInitTrigFunc" 'string "MYinitSession")
which could be added in your .cdsinit (along with a function defined MYinitSession which could add the menus, I guess).
I have found there are many *.menus in folder(tools/menus), but I think these are all system bulit in and only can be read, so if the user want to create their own menu file, where to loacate it? in the work directory ? which one is the best reference manul about this?
You can create a "menus" directory in your home directory, or current working directory, for example, and then have an appropriately named <tool>.menus file - this file can be used to reference the default menus file, for example load it in and then modify the structures in place, if you only needed a small alteration from the original. Some menus are easier to do this way, in my opinion. Here is a brief example of changing the File->Exit item in the CIW menus using this method:
load(prependInstallPath("etc/tools/menus/ciw.menus"));; only when the ciwFilePulldown menu existswhen(pairp(ciwFilePulldown) ;; create a local variable to store the Exit item let( ((exitItem assoc('ExitItem caddr(ciwFilePulldown)))) ;; replace the callback on the Exit item to be MYexit() ;; if the correct menu structure is found when(and(exitItem cddr(exitItem)) setcar(cddr(exitItem) "MYexit()") ) ))
The file would be called "ciw.menus" and be in the menus directory as mentioned above. This modifies the menu callback of the existing File -> Exit menu item such that the function "MYexit()" is called instead of the default callback.
I hope that this is helpful.
In reply to skillUser:
I have got the brief idea, and i am still confused about some tips
1, you just modify an exit function in the user "ciw.menus" in the above example, i want to know if the other functions will be saved/reserved as the default function in the ciw menus.
2. Can the "MYexit()" function be defined in other file skill file?
3.how to check wether user's menus(xxx.menus) is working well, i mean that check it in CIW
4. i want to add a user menu in analogArtist simulation window, but i'm not clear about which viewType should i use to register my menu trigger deRegUserTriggers()
5. if i change the analogArtist menu by modifying the simui.menus(is it the menus for analogArtist simulation window), i want to add a menu item under the Tools menu(below the parametric analysis), what i need to do is just add my menu item name and callback function in the Tools section in the simui.menus. by the way, do i need to create this menu item before i add it or not?
sorry for askiing so many question!
I will try to answer each of your questions.
1) Yes, the benefit of modifying the list "in place" is that everything else remains as it was and should have the default behaviour.
2) Again, yes, typically your utility functions would be defined in a file that is read by the .cdsinit startup SKILL file (or the function could be defined directly in the .cdsinit file, but generally it is cleaner to load these files).
3) ?? Eh? Start the session, test it. For debugging purposes you might be able to add a printf statement at the end of the file to say that the something.menus file was loaded, you should see it in the CIW. If you are modifying existing menus without adding or removing anything else then the menu may appear to look the same; perhaps this is your question? Through SKILL you could check what the menu item callback was...
4) Sorry, I have not customized the ADE menus, so I will leave this to Andrew or someone else to reply to.
5) Did you read the <instDir>/tools/dfII/etc/tools/menus/simui.menus file? I believe it mentions a function sevAddMenuItemLists() that you might be able to use. Again, I have not played with customizing the ADE menus, so someone else may be able to add some value here.
When i executes your above code it shows error unbound var _args .So i assign _args = geGetWindowCellView.it shows
error (hiMenu@0xf2b9088).plz let me know advice on this.
In reply to SarathKumarG:
Which code are you talking about? Is it the code in this link? If so, I can't see why it would complain about _args being unbound. Setting it to geGetWindowCellView() would be wrong, but it wouldn't cause that error. It doesn't really matter what it's assigned to, because it's not used (that's why I used the underscore convention to indicate that this is an argument that must be there, but isn't used inside the function).
Please (not "plz" - there's no tax on characters here, so please use proper English words rather than instant messaging shorthand - see the Forum Guidelines) could you post the code you're actually using - that will make it clear an unambiguous. In fact you really should have started a new topic rather than carrying on an old one which is nearly a year old - also covered in the guidelines. But you've done it now...
How would we define a menu item that intentionally reloads the menu so we can test its functions, by reloading it from the interface, instead of closing the session each time? The userMenuTrigger will not allow itself to be reloaded, preventing an update to the menu in-session.
I am using something like the following in my attempt -
[Menu_Item_Update = hiCreateMenuItem(?name 'Update ?itemtext "Update" ?callback "load("Menu.il") ); ]
deRegUserTriggers("maskLayout" nil 'Menu)
So if my Menu is already defined, it is not being re-registered. It may be getting updated, but is not reflected in the current session. If I remove the "unless" construct, I get
*Error* User menu trigger already registered for viewtype maskLayout.
*Error* load: error while loading file - "Menu.il"
In reply to jaleco:
I see that the bang (!) character was misused, but regardless, the userMenuTrigger will not allow a reload of the menu in the same session. Is there a way around this?
You could update the manu without closing the session, all you need to do is before adding menu just check if that menu exists or not.
If it exists , please remove from the window and add again.
hiInsertBannerMenu(win trPulldownMenu length(hiGetBannerMenus(win)))
before the above command you need to remove the exixting menu if it exists.
In reply to AmitBiswas:
thank you for your response. I don't know how my post got attached to this thread - I was replying to the following example by Andrew Beckett and have created a new Post per his guidelines -
Per his guidance I am avoiding the InsertBannerMenu construct in favor of the list passed as a MenuTrigger argument to deRegUserTriggers()....but not finding that it works for something that needs to be redefined in-session.
Ah, I see, there are 2 pages of thread and I was initially looking at the first page....