Windows 10 64 Lua version 5.1 iup.lua version 3.11.2 at present, I am locked into these versions.
the code as is works tolerably well, it is the base for a general table reader I am making, that will allow certain functions to operate on those tables. I have two issues, both are easily found by searching for: ' -- this '. the first one, how is the size of opt decided for input and output? at some point, depending on input parameters to a larger program, I wish them to be either one or two bytes, and will only contain numbers that will lead to functions to perform on that table entry on that key. I want them to display as void ('') if there is no number entered into it. I do not understand how to control that size programmatically. The second issue I am trying to deal with is to calculate the raster size, but I have no idea what the numbers I get back from iup.Map are and how they relate to what is inside the containers, as well as the container burden. I would like to caclulate the window to be whatever the row display is, displaying all fields to a limit in the original window, and the number of columns fully displayed based on some pagesize divided by total number of records. I am quite sure both of these things are doable, I just cannot see how. on my screen it shows up _rs and _ns (rastersize and natural size) as 141X117 but that does not show the entire width of the entries at 141, and I am unsure how I would change 117 to some multiple or divide to show x number of entires in the initial window. Thank you. Ron Melby require 'iuplua' iup.SetGlobal('CUSTOMQUITMESSAGE', 'YES') iup.SetGlobal('UTF8MODE','YES') iup.SetGlobal('UTF8MODE_FILE', 'NO') WS_Abort = 'Abort' WS_CANCEL = false WS_Cancel = 'Cancel' WS_ENTER = true WS_Ignore = 'Ignore' WS_OK = 'OK' WS_Retry = 'Retry' WS_ERR = 2 WS_YES = 'Yes' WS_NO = 'No' local rtx = {} function set_IO_io(options) -- there are no mandatory options local IOfld = iup.text { visiblelines = options.visiblelines or '1', multiline = options.multiline or 'NO', readonly = options.readonly or 'NO' } if options.value then IOfld.value = options.value else IOfld.value = '' end if options.filter then IOfld.filter = options.filter end if options.mask ~= nil then IOfld.mask = options.mask end return IOfld end function set_IO_o(options) local Ofld = iup.label { title = options.value or '', visiblelines = options.visiblelines or '1', multiline = options.multiline or 'NO', readonly = options.readonly or 'NO' } return Ofld end function _sfl_WRITE(siz) local _sfl = iup.gridbox { alignmentlin = 'ACENTER', expandchildren = 'NO', gaplin = '10', gapcol = '10', normalizesize = 'BOTH', numdiv = 5, orientation = 'HORIZONTAL', } for k, v in pairs(siz) do -- this local opt = set_IO_io { name = opt, value = nil, readonly = 'NO' } _sfl:append(opt) local key = set_IO_o { name = k, value = k, readonly = 'YES' } _sfl:append(key) local M = set_IO_o { name = 'M', value = v.M, } _sfl:append(M) local X = set_IO_o { name = 'X', value = v.X, } _sfl:append(X) local B = set_IO_o { name = 'B', value = v.B, } _sfl:append(B) end return _sfl end function _sfl_CTL(_WS) local sfl = iup.vbox{iup.scrollbox{_WS}} local btn_ok = iup.button { name = 'ENTER', title = 'ENTER', action = function(self) _sfl_READC(_WS) rtx.rc = WS_ENTER rtx.TAG = TAG return iup.CLOSE end } local btn_cancel = iup.button { name = 'CANCEL', title = 'CANCEL', action = function(self) rtx.rc = WS_CANCEL rtx.TAG = '' return iup.CLOSE end } local fn_keys = iup.hbox{btn_ok, btn_cancel} local _ws_dsp = iup.dialog { iup.vbox{sfl, iup.hbox{fn_keys}}, title = 'Column multipliers (y=mx + b)', margin = '5x5' } -- this local _ms = iup.Map(_ws_dsp) local _rs = _ws_dsp.rastersize local _ns = _ws_dsp.naturalsize if _rs then local _wide, _high = _rs:match('(%d+)[X-x](%d+)') end _ws_dsp.size = _rs or _ns return _ws_dsp end -- fn _sfl_CTL function _sfl_READC(_WS) for row = 1, _WS.numlin do local ent = iup.GetChild(_WS, (i - 1) * _WS.numcol) local __opt = ent.value local __key = iup.GetBrother(__opt) end end siz = { ["arm"] = { ["M"] = 0, ["X"] = 4, ["B"] = 0, }, ["dst"] = { ["M"] = 0, ["X"] = 4, ["B"] = 4, }, ["iid"] = { ["M"] = 0, ["X"] = 6, ["B"] = 0, }, ["fid"] = { ["M"] = 0, ["X"] = 6, ["B"] = 0, }, ["ara"] = { ["M"] = 0, ["X"] = 4, ["B"] = 0, }, ["tim"] = { ["M"] = 0, ["X"] = 3, ["B"] = 0, }, ["era"] = { ["M"] = 0, ["X"] = 1, ["B"] = 0, }, ["nam"] = { ["M"] = 0, ["X"] = 4, ["B"] = 1, }, ["bin"] = { ["M"] = 0, ["X"] = 4, ["B"] = 4, }, ["rlt"] = { ["M"] = 0, ["X"] = 4, ["B"] = 4, }, ["dod"] = { ["M"] = 0, ["X"] = 4, ["B"] = 0, }, ["dir"] = { ["M"] = 0, ["X"] = 4, ["B"] = 2, }, ["yr"] = { ["M"] = 0, ["X"] = 1, ["B"] = 0, }, ["age"] = { ["M"] = 0, ["X"] = 6, ["B"] = 0, }, ["sep"] = { ["M"] = 0, ["X"] = 4, ["B"] = 0, }, ["gpi"] = { ["M"] = 0, ["X"] = 4, ["B"] = 4, }, ["plc"] = { ["M"] = 0, ["X"] = 4, ["B"] = 0, }, ["err"] = { ["M"] = 0, ["X"] = 4, ["B"] = 0, }, ["cem"] = { ["M"] = 0, ["X"] = 4, ["B"] = 4, }, ["sdf"] = { ["M"] = 0, ["X"] = 4, ["B"] = 0, }, ["lbl"] = { ["M"] = 0, ["X"] = 4, ["B"] = 0, }, ["trk"] = { ["M"] = 0, ["X"] = 4, ["B"] = 0, }, ["rnk"] = { ["M"] = 0, ["X"] = 4, ["B"] = 0, }, ["web"] = { ["M"] = 0, ["X"] = 4, ["B"] = 4, }, ["svc"] = { ["M"] = 0, ["X"] = 4, ["B"] = 2, }, ["ahn"] = { ["M"] = 0, ["X"] = 6, ["B"] = 0, }, ["ptg"] = { ["M"] = 0, ["X"] = 4, ["B"] = 0, }, ["erx"] = { ["M"] = 0, ["X"] = 1, ["B"] = 0, }, ["src"] = { ["M"] = 0, ["X"] = 4, ["B"] = 0, }, ["sex"] = { ["M"] = 0, ["X"] = 1, ["B"] = 0, }, ["set"] = { ["M"] = 0, ["X"] = 6, ["B"] = 0, }, ["rte"] = { ["M"] = 0, ["X"] = 4, ["B"] = 2, }, ["mml"] = { ["M"] = 0, ["X"] = 4, ["B"] = 0, }, ["gps"] = { ["M"] = 0, ["X"] = 1, ["B"] = 4, }, ["gen"] = { ["M"] = 0, ["X"] = 6, ["B"] = 0, }, ["adr"] = { ["M"] = 0, ["X"] = 4, ["B"] = 1, }, ["rgn"] = { ["M"] = 0, ["X"] = 4, ["B"] = 4, }, ["war"] = { ["M"] = 0, ["X"] = 4, ["B"] = 0, }, ["rmn"] = { ["M"] = 0, ["X"] = 6, ["B"] = 0, }, ["mdt"] = { ["M"] = 0, ["X"] = 4, ["B"] = 0, }, ["ptr"] = { ["M"] = 0, ["X"] = 1, ["B"] = 0, }, ["gli"] = { ["M"] = 0, ["X"] = 4, ["B"] = 0, }, ["oth"] = { ["M"] = 0, ["X"] = 4, ["B"] = 0, }, ["ord"] = { ["M"] = 0, ["X"] = 4, ["B"] = 0, }, ["nct"] = { ["M"] = 0, ["X"] = 8, ["B"] = 0, }, ["loc"] = { ["M"] = 0, ["X"] = 4, ["B"] = 4, }, ["dob"] = { ["M"] = 0, ["X"] = 4, ["B"] = 0, }, ["fct"] = { ["M"] = 0, ["X"] = 8, ["B"] = 0, }, ["dup"] = { ["M"] = 0, ["X"] = 4, ["B"] = 0, }, } -- EXEC() if not _WS then _WS = _sfl_WRITE(siz) _ws_dsp = _sfl_CTL(_WS) end _ws_dsp:show(iup.CENTER, iup.CENTER) iup.MainLoop() _ws_dsp:destroy() return
_______________________________________________ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users