Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Passing variables from menus
#1
Is it possible to pass a variable from a menu list to the calling macro.

For instance I have three names

John Jones
Judy Smith
Paul Johnson

When the person selects the first name I would like a string variable like Name to equal "JOHN JEREMIAH JONES". I need this to work in the menu format so I do not have to rewrite if statements based on the number returned from the menu. Currently the variable 'Name' is getting a number pushed into from the menu even though I have menu populated as

John Jones :"JOHN JEREMIAH JONES"

It pushes the text into a blank field if it on a place where text can be entered but the name variable is still just showing 1 no matter how I create the string variable. Is what I am asking possible?

The command I am currently using in the calling macro = AgentName = mac("Menu - AVS Agents")

Thanks.
#2
Look in QM Help -> Pop-up menu -> How to show a menu from code.

Menu Menu - AVS Agents
Code:
Copy      Help
;/noicons /dontrun
John Jones : JOHN JEREMIAH JONES
Judy Smith :
Paul Johnson :

Macro Macro1860
Code:
Copy      Help
if(!mac("Menu - AVS Agents")) ret
str sLabel sCode
GetLastSelectedMenuItem &sLabel &sCode
out sLabel
out sCode
#3
Example with PopupMenu class and CSV. It works in exe too. CSV is specified in same macro, but it also can be loaded from a macro, file, registry etc.

Macro Macro1862
Code:
Copy      Help
str itemsCSV=
;John Jones, JOHN JEREMIAH JONES
;Judy Smith, "JUDY SMITH, X"
;Paul Johnson
ICsv c=CreateCsv(1); c.FromString(itemsCSV)

MenuPopup m
int i
for i 0 c.RowCount
,m.AddItems(c.Cell(i 0) i+1)

i=m.Show
if(!i) ret
str s=c.Cell(i-1 1)
if(!s.len) s=c.Cell(i-1 0)
out s
#4
Thank you so much for the help with the coding. This is one of the reasons I purchased this program, it has wonderful support. It is a very powerful program that I have yet to fully realize its awesome potential. Keep up the great work. You are definitely helping many people increase their efficiency.

I am still working on how to incorporate the knowledge you have provided. I am making great progress. I now have some awesome tools to make macros and stand alone macros of a high caliber.

WW


Forum Jump:


Users browsing this thread: 1 Guest(s)