Jump to content

Access the Menubar with Visual Lisp


Recommended Posts

Posted

All,

 

Can anyone provide any examples of the "PopupMenu" and "Insertinmenubar" tags?

 

Thanks,

 

Matt

Posted

This is what i have so far:

(setq menu (vla-get-menubar(vlax-get-acad-object)))
(setq menu_count (vla-get-count menu))
(setq prln_list "")
(repeat menu_count
 (setq item_count (- menu_count 1))
 (setq names (vla-get-name (vla-item menu item_count)))
 (if (= names "Setty")
   (progn
     (setq prln "\nMenu already loaded.")
     (setq prln_list (list item_count names))))
 (setq menu_count (1- menu_count))
 (princ))
(if prin_list
 (progn
   (setq count (itoa (+ (car prln_list) 1)))
   (setq name (cadr prln_list))
   (princ (strcat "\nThe menu: " name ", was found in the " count " position of the menu bar.")))
 (princ "Setty Menu not loaded."))
(princ)

 

I still need to know how "insertinmenubar" works.

 

Thanks,

Matt

Posted

Something like this?

 

(defun InsMenu ( menu / acapp ) (vl-load-com)
 
 (vlax-for n (vla-get-MenuGroups (setq acapp (vlax-get-acad-object)))
   (if (eq (vla-get-name n) menu)
     (vla-InsertinMenuBar (vla-item (vla-get-menus n) 0) (1- (vla-get-Count (vla-get-MenuBar acapp))))
   )
 )
)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...