Yep.
See "on_leave" callback for second tab in attached example.
When you leave tab, it print value of edited text field.


12/19/2014 11:02, Milind пишет:
Is it possible to read the current value in the editing text box? If I can read 
that then I can track the edition and read the current value and finalize it. 
Is it possible yo access the text box?
local iup = require("iuplua")
require("iupluacontrols")


local APP = {}

APP.dlg = iup.dialog{
    iup.tabs{
        tabchange_cb = function (this, new_tab, old_tab)
            --APP.cur_tab = new_tab
            if old_tab and old_tab.on_leave then
                old_tab:on_leave()
            end
            if new_tab and new_tab.on_enter then
                new_tab:on_enter()
            end
        end,

        iup.vbox{
            TABTITLE = "1",
            iup.matrix{
                NAME = "M1", -- user-specified id
                NUMCOL =3,
                NUMCOL_VISIBLE = 3,
                NUMLIN = 3,
                NUMLIN_VISIBLE = 3,
                FONTSIZE = 10,
                CURSOR = "ARROW",
                WIDTHDEF = 20,
                HEIGHTDEF = 10,
            },
        },
        iup.vbox{
            TABTITLE = "2",
            on_enter = function(this)
                -- we can locate control via an uniq ID
                local m = iup.GetDialogChild(this, "M2")
                if m then
                    -- do some stuff with matrix with NAME "M2"
                end
            end,
            on_leave = function(this)
                -- for sample, we can locate text field edited
                --   in an matrix via checking several conditions
                local t = iup.GetFocus()

                if t and iup.GetClassName(t) == "text" then
                    local m = iup.GetParent(t)
                    if iup.GetClassName(m) == "matrix" then
                        print("VALUE", t.VALUE)
                    end
                end
            end,
            iup.matrix{
                NAME = "M2", -- user-specified uniq id
                NUMCOL =3,
                NUMCOL_VISIBLE = 3,
                NUMLIN = 3,
                NUMLIN_VISIBLE = 3,
                FONTSIZE = 10,
                CURSOR = "ARROW",
                WIDTHDEF = 20,
                HEIGHTDEF = 10,
                killfocus_cb = function(this)
                    print("KF")
                end,
            },
        },
    },
}

APP.dlg:showxy(iup.CENTER, iup.CENTER)

iup.MainLoop()
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to