Combo-box/popup menu in a list field?

Ben Rubinstein benr_mc at cogapp.com
Fri Feb 21 06:39:01 EST 2003


on 20/2/03 6:21 pm, valetia at mac.com wrote

> How do you create a combo-box/popup menu that appears *inside* a scrolling
> list field?
> 
> Specifically one that appears on each line of a certain column (the list
> field has vGrid set to true)?

Depending just what you want - most probably Ken's suggestion is best
(instead of a scrolling field, use a scrolling group, with multiple popup
menu buttons, one for each line).  But it's possible that your requirement
is more like the one I had recently; I wanted the same menu to appear on
each line, but only when the user clicks.

For this you have a hidden popup menu button somewhere on the card, and use
the 'popup' command to make it appear in the right place when the user
clicks.

Even if you want the appearance of the menu control (something with a little
triangle on it, for example) to appear on every line, it might be easiest to
use an image for that, which can be part of the 'text' of the scrolling
field, and then have a single menu which you popup on command, rather than
having to clone the menu button for each line.

Note that, AFAIK, there's no way for the handler which issues the 'popup'
command to get the results of the popup, without cooperation from the menu
button.  IE if you have to script the menu button (in a 'menupick' handler)
to either know what it should do, or send the message on to the field or
wherever else you're handling things.

Jeanne - I think this is an area which could be better covered in the docs,
specifically the entry in the transcript dictionary for the 'popup' command.
It explains how to popup either a button menu or stack - but doesn't tell
you where the result of the user's selection ends up.  I had to hunt around
to figure out the answer in each case (and of course the answer is different
for button menus and stack menus).  (One of the recipes in the new cookbook
mentions the answer for the button case.)

Scott, if you're reading - it would be a tremendous shortcut if there was a
mode of the 'popup' command that made it behave like the 'modal' command -
so a handler (somewhere) could issue a 'popup' command and in the following
statement test the result to find out what the user selected.
 
  Ben Rubinstein               |  Email: benr_mc at cogapp.com
  Cognitive Applications Ltd   |  Phone: +44 (0)1273-821600
  http://www.cogapp.com        |  Fax  : +44 (0)1273-728866





More information about the use-livecode mailing list