I have a list control (Place) with both dropdown and editbox true. The user
can either select an existing value or enter a new one.  Using IUP 3.5 with
Lua under windows.

 

If they select an existing value, I need to populate a second list control
(Address) - also dropdown and editbox - with the known addresses for the
selected Place.

 

If they enter a new Place via the editbox, I need to eliminate duplicate
spaces and check if it is still a new Place. If it's not new, I need to
select the 'duplicate' Place (the one they should have selected) and
populate the Address list; if it is new, I need to update a lookup table and
clear the Address list.

 

I'm trying to determine the best call backs to use to implement this.

 

Should I be using Action to detect is an existing item is selected? If I'm
reading the documentation correctly, because it's an editbox, Place.VALUE
won't tell me what the selected item is if it's an existing item, but the
text and parameters for the Action callback will?

 

Or Valuechanged? Again, Place.VALUE won't help for an existing item.

 

Or should I be using a combination - if Action fires, then an existing item
has been selected (does it fire if a new item is added?); and if
Valuechanged fires, it's a new item? Or might they both fire, in which case
what would be the order.

 

And if so, how do I define two callbacks within this (parameterised)
structure:

 

    function MakeList(options)

       local l = iup.list{}

        if options.callback ~= nil then

            local callback = options.callback

            local ebox = (options.editbox or "NO") == "YES"

            if ebox then

                l = iup.list{valuechanged_cb = function(self) callback()
end}

            else

                l =iup.list{killfocus_cb = function(self) callback() end }

            end

        end

        l.editbox = options.editbox or "NO"

       l.dropdown=options.dropdown or "YES" 

       return l

    end

 

 

 

 

 

 

_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to