Combobox Value/Display Members

Jan Schenkel janschenkel at yahoo.com
Mon Jun 30 16:22:00 EDT 2003


--- Jez <jbradshaw at blueyonder.co.uk> wrote:
> I can see that works but still dont see how I can
> "get at" the underlying
> numeric value of the combobox.  Does this mechanism
> only work for values
> 1,2,3,4,etc or will it also work for any values
> (1,10,55,80, etc)
> 

To get the actual value, read the 'menuHistory'
property of the option menu.
In this version of the revDatabase functionality, the
values have to be consecutive numbers, starting at 1.
However, you can use the following trickery by
employing an 'in-between' field:
- suppose you want the following setup
     1 = "Pink"
    10 = "Blue"
    55 = "Yellow"
    80 = "Black"
- make a new field, name it "RealValue", and use the
inspector palette to link it to your query and the
right numeric column ; also make sure to check the
"Update after editing" checkbox
- now create an option menu, name it "ValuePicker";
use the "Custom properties" panel in the inspector to
create a custom property 'uRealValues', and put the
real numeric values line per line as they correspond
to the text ; so :
1
10
55
80
- now set the script of the option menu to :
  on menuPick
    put the menuHistory of me into tLineNumber
    put line tLineNumber of the uNumericValues of me \
        into field "RealValue"
    send "closeField" to field "RealValue"
  end menuPick
- this ensures that whenever we make a change in the
option menu, the change will be sent to the database ;
however, we still need to make sure that the option
menu is updated when we go to a different record
- assuming you've made first/prev/next/last buttons
with database 'actions' linked to the same query, we
can do it quite easily :
 + group the buttons
 + set the group script to
     on mouseUp
       set the menuHistory of btn "ValuePicker" to \
           the text of fld "RealValue"
     end mouseUp
- this ought to wrap it up ; once everything has been
verified to work properly, you can set the visible of
the "RealValue" field to false, and nobody will ever
know you resorted to trickery ;-)

Hope this helped, and if anything was unclear, don't
hesitate to poke us.

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com



More information about the use-livecode mailing list