Hi Antonio,

(Version 3.18 Win 64-Lua 5.3 Tested on Win7 and Win10)

I've been colourising my Matrixes. I have found a discrepancy in the
Documentation

===============

*BGCOLOR_CB* - Action generated to retrieve the background color of a
cell when it needs to be redrawn.

int function(Ihandle **ih*, int *lin*, int *col*, int **red*, int **green*, int 
**blue*); [in C]
*ih*:bgcolor_cb(*lin, col*: number) -> (*red, green, blue, ret*: number) [in 
Lua]

*ih*: identifier of the element that activated the event.
*lin*, *col*: Coordinates of the cell.
*red*, *green*, *blue*: the cell background color.

==============

It seem clear to me-- from this-- that the function return should be
    return red, green blue

However the correct return for green and blue is
        return  green, blue

I can't seem to get red to work at all.
It shows red as black, which looks same as returning 0,0,0

I have attached my test program in lua.

Regards,

John



require( "iuplua" )
require( "iupluacontrols" )

matrix = iup.matrix
{
    numlin=3,
    numcol=3,
    numcol_visible=3,
    numlin_visible=3,
    height0=10,
    widthdef=30,
    scrollbar="NO",
}

data = {
        {"1:1", "1:2", "1:3"}, 
        {"2:1", "2:2", "2:3"}, 
        {"3:1", "3:2", "3:3"}, 
       }

function matrix:value_cb(l, c) 
  if l == 0 or c == 0 then
    return nil--"title"
  end
  return data[l][c]
end

function matrix:value_edit_cb(l, c, newvalue)
  data[l][c] = newvalue
end

function matrix:edition_cb(l, c, mode, update)

end


function matrix:bgcolor_cb(l, c)
        -- play here
        local green =0
        
        local blue =0
        local red  =200
        
                if c == 0 then
                        return nil              -- title row, not used
                end

                if l == 0 then          -- title column
                        return nil
                end

                return  green, blue, red
        end


dlg=iup.dialog{matrix; title="IupMatrix in Callback Mode" }
dlg:show()

if (iup.MainLoopLevel()==0) then
  iup.MainLoop()
end
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports. http://sdm.link/zohomanageengine
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to