PDA

View Full Version : Adding custom Pop Menu via code to the menu bar.



dfe
2006-09-13, 02:35 PM
I wrote Lisp code which will execute from acad2006doc.lsp and check to see if a certain Popup Menu (defined in a partial CUI file) is displayed in the current menu bar. If not, I manipulate the object model classes MenuBar and MenuGroups (and their sub-classes) to display it. The code works fine, but what I noticed is that the Customer User Interface does not register these changes I made through the object model. I can see my partial CUI in the CUI screen, but the popup menu is not check to indicate that it is being displayed. I'm concerned with the fact that the CUI is "out of synch" and that this may cause problems further down the line when users start feeling comfortable with manipulating the CUI themselves. Any thoughts?

RobertB
2006-09-14, 01:48 AM
Why not simply use a workspace? I used to do such swapping pre-CUI, but went to workspaces with the CUI.

rkmcswain
2006-09-14, 02:11 AM
Ditto Robert, and another note, any custom code should really be in "acaddoc.lsp", not "acad200xdoc.lsp"

dfe
2006-09-14, 01:58 PM
I looked at the workspace command but could not figure out how to add a menu to the current workspace from a lisp program. This code has to run without any actions from the user and the only way I know how to edit a workspace is through the CUI screen.

RobertB
2006-09-14, 08:31 PM
Are you doing this as an internal app in-house, or are you attempting to create an installer package for other firms to use your app?

dfe
2006-09-14, 08:52 PM
Installer package for other firms.

Gary.Orr
2006-10-20, 01:36 PM
I wrote Lisp code which will execute from acad2006doc.lsp and check to see if a certain Popup Menu (defined in a partial CUI file) is displayed in the current menu bar. If not, I manipulate the object model classes MenuBar and MenuGroups (and their sub-classes) to display it. The code works fine, but what I noticed is that the Customer User Interface does not register these changes I made through the object model. I can see my partial CUI in the CUI screen, but the popup menu is not check to indicate that it is being displayed. I'm concerned with the fact that the CUI is "out of synch" and that this may cause problems further down the line when users start feeling comfortable with manipulating the CUI themselves. Any thoughts?
For anyone reviewing this thread...

In lisp add the following:
(setq currws (getvar "wscurrent"))
(if currws (command "workspace" "saveas" currws "yes"))

It's a trick that I do with profiles as well. Saving the current workspace will update it with current settings.