Page 1 of 1

Pulldown menus

Posted: Thu Nov 20, 2014 1:22 am
by stephenlewis
Hi Guys

Got myself all turned around again!! On a card I'm trying to create a pull down menu which is populated by the contents of three fields. As the content of the fields change so do the menu items. The user can then choose an item and the relevant field content is displayed. I've created a substack with the three fields on it and linked this to a button on my card. When I click on the button the substack card opens with three fields displayed. However, this isn't what I'm after. Could someone point me in the direction of a script example to get me moving in the right direction? Just how do I get the content of three fields to populate a pull down menu? Thanks

Re: Pulldown menus

Posted: Thu Nov 20, 2014 1:44 am
by [-hh]
Hi.
You could try this.
Fields are preferably list fields or non-wrapping fields, script of the menu button:
Instead of "fld 1" etc you have to write a closer identifying epression, may be
fld 1 of card 1 of stack "yoursubstack"
or so. Just try.

Code: Select all

local fldLineNums
on menuPick
  put the menuhistory of me into n0
  switch
    case n0 <= item 1 of fldLineNums; select before line n0 of fld 1; break
    case n0 <= item 2 of fldLineNums
      select before line (n0 - item 1 of  fldLineNums) of fld 2; break
    default; select before line (n0-item 2 of fldLineNums) of fld 3; break
   end switch
end menuPick

on mouseDown
   put the num of lines of fld 1 &","& the num of lines of fld 2 into  fldLineNums
   put fld 1 & cr & fld 2 & cr & fld 3 into me
end mouseDown

Re: Pulldown menus

Posted: Thu Nov 20, 2014 2:09 am
by stephenlewis
Many thanks!! That works fine, although I'll take time out to sort out exactly what's happening! Cheers.