Combobox filled from database

J. Landman Gay jacque at hyperactivesw.com
Mon May 11 14:49:41 EDT 2009


Josep wrote:
> Yes, the syntax is the same, but how combo or option show the values when
> click is different. In combo you have a scrollbar to move between the values
> and with option all the values are showed..

I agree with Bill that a combo box isn't the best choice for this, but 
you could do it like this:

Create a custom property of the button with the real list you want to 
use. Separate the two values on each line with a comma (or a tab if you 
prefer), like this:

   Color,pink
   Shape,square
   Visible,true

In the button's menu, put only the first item of each line:
   Color
   Shape
   Visible

When the user chooses an item, it will be returned to the menupick 
handler as the first parameter. Then you search the custom property to 
get the second value:

on menuPick which
  put the cValues of me into values
  put lineoffset(which, values) into lineNum
  put item 2 of line lineNum of values into userChoice
end menuPick

The variable "userChoice" now contains the second item in the chosen line.

You will have to determine what to do when the user types an entry into 
the combobox that does not exist in your property list.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list