--- In [email protected], "lakeshoresurfer" <[EMAIL PROTECTED]> wrote:
>
> Hi Sherry,
> 
> As always great advice.
> 
> To refine this code, would it be possible to 
> attach an ampersand(@) to the individual vector lines, so
> that once the vector items are shown as menu you would only
> need to enter the respective ampersand linked character,
> for instance if "Text&1" could be used, hitting the "1" key
> would directly select that item, and then only "enter" need
> to be hit to trigger the underlying script.

Hmmn, the accelerator keys work, they're just not underlined when the
items are presented as a vector menu.

But, you can do anything you want if you show the menu as part of a
command list. See below for instance.

Regards,
Sheri

Function ShowScriptChoices()
if (cl.exists("ScriptChoices")== 0)
  BuildMenu()
cl.showmenu("ScriptChoices")
local i=cl.getLastMenuSel()
if (i>0) do
local scriptchoice="script"++i
call(scriptchoice)
endif
quit

Function BuildMenu()
local v=vec.create(5)
v[0]="Script Menu"
v[1]="Text&1"
v[2]="Text&2"
v[3]="Text&3"
v[4]="Text&4"

;i=v.showmenu

local tempmenu = cl.create("ScriptChoices",1)
local menufont="Sans Serif"
local menufontsize=9
TempMenu.NewProperties("fontname = " ++ menufont ;;+
++ "\nfontinfo = Bold Size: " ++ menufontsize ;;+
++ "\nformat = textcenter text: 0 0 128 back: 0 255 255")

for each elem index i in v
  local hitem = TempMenu.insert(TempMenu.length)
  hitem.setlabel(v[i])
  if (i==0) do
    hitem.setenabled(0)
    hitem.settextcolor("255 255 255")
    hitem.setbackcolor("0 0 175")
  endif
endfor
quit


Reply via email to