Solved

HOW TO GET MENUITEM TAGSTRING OR LABLE OF CLICKED MENUITEM USING VBA/LISP

Posted on 2004-09-30
4
294 Views
Last Modified: 2008-02-01
running autocad map 5, this what I'm trying to do. I have several saved queries that I am running from a dropdown menu in a some what clunky way, got an idea to change it but am stumped.
I want to be able to click on the menu item and have it run a single dvb project (the same one for all) that gets the tagstring of the selected menuitem then runs the query using the 'case' method based on that tag string.
Right now I've got a seperate sub for each menuitem that uses a function call to the query function, and they are filling up my macro manager.
Is it even possible to get the tagstring of the clicked menuitems/toolbar items? I think this might be a good way to do a block insert toolbar also.
Thanks for any help, I've been stumped for 2 days.
willing to use lisp or a combo of the 2 if I have too....
0
Comment
Question by:norrin_radd
  • 2
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
david_barker earned 250 total points
ID: 12212634
One (of many possible) solutions, trying to avoid AutoLISP, except just for the SETVAR (but could of done it without) :

The pop-up menu :

***POP13
**TEST
M_test  [&My test]
M_act_1 [Action &1]^C^C(setvar "USERI1" 1) -EXECVBA "c:/temp/MyProjet.dvb!MyModule.Hello"
M_act_2 [Action &2]^C^C(setvar "USERI1" 2) -EXECVBA "c:/temp/MyProjet.dvb!MyModule.Hello"
M_act_3 [Action &3]^C^C(setvar "USERI1" 3) -EXECVBA "c:/temp/MyProjet.dvb!MyModule.Hello"

The VBA code :

Public Sub Hello()
  MsgBox ThisDrawing.GetVariable("USERI1")
End Sub

This assumes that the system variable USERI1 isn't used elsewhere in your application.
0
 
LVL 10

Author Comment

by:norrin_radd
ID: 12217856
man I forgot about the useri variables thanks I think that will work good. just out of curiousity how would you have done it without those? and I'm guessing but it doesnt look like there is a way to get the tagstring of a clicked menuitem?
thanks again
0
 
LVL 6

Expert Comment

by:david_barker
ID: 12217991
I could of used a shared variable between Visual Lisp and VBA, but that would of got somewhat complicated.
Or perhaps I would of used the BeginCommand event.
Or, to be honest, by doing everything in plain old AutoLisp, ie.
  M_act_1 [Action &1]^C^C(hello 1)
where "hello" is my AutoLisp funtion.
0
 
LVL 10

Author Comment

by:norrin_radd
ID: 12218492
good points thanks,
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The following article will describe how to add/edit a dimension style through AutoCAD VBA. AutoCAD VBA has its quirks and when it comes to dimensions and controlling how they look through VBA.  This is where AutoCAD can be vividly confusing. The…
In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now