Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Popup menu position

0 views
Skip to first unread message

Marcel Goulet

unread,
May 31, 2004, 12:59:48 PM5/31/04
to
Hi,

In lisp or Vlisp, how can I obtain the position of a popup menu among all the displayed menus?

For exemple, the menu Draw.

Thanks

SpeedCAD

unread,
May 31, 2004, 6:24:02 PM5/31/04
to
Hi...

With this ;):

(defun PosMenu (menuname / i posicion noexiste)
(setq i 0)
(vlax-for menu
(vla-get-menus
(vla-item
(vla-get-menugroups
(vla-get-application
(vla-get-activedocument (vlax-get-acad-object))
)
)
"ACAD"
)
)
(if (or (equal (strcase menuname) (strcase (vla-get-name menu)))
(equal (strcase menuname)
(strcase (vla-get-namenomnemonic menu))
)
)
(setq posicion i)
(setq noexiste "\nNo existe")
)
(setq i (1+ i))
)
(if posicion
(prompt (strcat "\n" (rtos posicion 2 0)))
(prompt noexiste)
)
(prin1)
) ;_defun

(posmenu "Draw") -> 6
(posmenu "draw") ->6
(posmenu "&draw") ->6
(posmenu "modify") ->9
(posmenu "speedcad") ->No existe

Un saludo de SpeedCAD... :)
CHILE
FORO: http://www.hispacad.com/foro

Marcel Goulet

unread,
Jun 2, 2004, 8:19:00 AM6/2/04
to
Hi Mr. SpeedCad ! :-)

I tried your program and it's not exactly what I need.

For exemple, if I try your program with the Express menu, of course I change the menu group in your program, the answer will be zero. Your program give the position in the menu file not in the current display.

The answer for the express menu should have been, in my case, position 10.

So do you think it's still possible to obtain the position in the current display of a popup menu among all the popup menus from different menu group ?

Thanks

Jason Piercey

unread,
Jun 2, 2004, 1:00:41 PM6/2/04
to
How about something like this?

; function return the position of [name] on the menubar
; Arguments:
; [name] - string, menu item name
; return: zero based integer or nil
(defun getMenuPosition (name / lst)
(vlax-for item (vla-get-menubar (vlax-get-acad-object))
(setq lst (cons (strcase (vla-get-namenomnemonic item)) lst)))
(vl-position (strcase name) (reverse lst))
)


--

Autodesk Discussion Group Facilitator


"Marcel Goulet" <nos...@address.withheld> wrote in message
news:3876103.1086178771477.JavaMail.javamailuser@localhost...

Marcel Goulet

unread,
Jun 2, 2004, 2:58:14 PM6/2/04
to
Thanks alot !

Jason Piercey

unread,
Jun 2, 2004, 4:23:19 PM6/2/04
to
You're welcome.

--

Autodesk Discussion Group Facilitator


"Marcel Goulet" <nos...@address.withheld> wrote in message

news:25981377.108620272...@jiveforum2.autodesk.com...
> Thanks alot !


Jason Piercey

unread,
Jun 2, 2004, 4:32:29 PM6/2/04
to
Perhaps that header should have been stated
differently as it will only find the first item specified
by [name], any duplicates would be ignored.

Duplicate menu names, not much sense, but possible.

--

Autodesk Discussion Group Facilitator


"Jason Piercey" <Jason@AtrEngDotCom> wrote in message news:40be0731$1_1@newsprd01...

0 new messages