Hi, all!

I about programmatically check/uncheck the iup.matrixlist entries.
It's can be toggled (from code) immediately only when entry value updated.
Else needed user's mouse-click to matrixlist area for redraw.
It's ok?

Play with example in attach.

--
With best regards,
  Karagy
local iup = require("iuplua")
require("iupluacontrols")

local APP = {}

APP.mxlist = iup.matrixlist {
    COLUMNORDER = "LABEL:COLOR:IMAGE",
    SHOWDELETE = "NO",
    EDITABLE = "NO",
    LIMITEXPAND = "YES",
    FOCUSCOLOR = "#7F7F7F",

    COUNT = 3,
    VISIBLELINES = 3,

    [1] = "Red",
    COLOR1 = "#FF0000",
    IMAGEVALUE1 = 1,

    [2] = "Green",
    COLOR2 = "#00FF00",
    IMAGEVALUE2 = 0,

    [3] = "Blue",
    COLOR3 = "#0000FF",
    IMAGEVALUE3 = 1,
}

APP.dlg = iup.dialog{
    iup.vbox{
        NGAP = 8,
        ALIGNMENT = "ACENTER",

        iup.hbox{iup.fill{},}, -- H-expander

        APP.mxlist,

        iup.button{
            TITLE = "Toggle Red",
            action = function (this)
                APP.mxlist.IMAGEVALUE1 = APP.mxlist.IMAGEVALUE1 == "0" and 1 or 0

                --- Comment/uncomment next line for redraw effect
                APP.mxlist[1] = APP.mxlist[1] -- hack for redraw

                iup.Update(APP.mxlist)

                --- next kicks can't help in this problem
                --iup.UpdateChildren(APP.dlg)
                --iup.Redraw(APP.dlg, 1)
                --iup.Flush()
                --iup.LoopStep()
            end,
        },
    },
}

APP.dlg:showxy(iup.CENTER, iup.CENTER)
iup.Refresh(APP.dlg)
--iup.Show(iup.LayoutDialog(APP.dlg))
iup.MainLoop()

------------------------------------------------------------------------------
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to