both issues are found by searching for: -- this
) to display 1 or 2 wide? (that will be a parm, but it will only be one of two values) as it is, if I can display it 1 wide somehow, I will parameterize the 1 or 2 wide case.
the second -- this, is sizing the dialog window the table in will be a parameter, as will the number and name of fields to display, so width would be some multiple of number of fields and size. and height would be some division of entries, taking a simple case, 40 entries which I might divide into 4 screens of 10, or 2 screens of 20. that calc is just moving numbers around, but translating it into this raster size for an original window, and knowing that math, and what it means is necessary for initial display and if they want to resize it. I think.
Code: Select all
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)
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, -- I want this to display 1 wide
value = fhConvertANSItoUTF8(string.char(0x00)), -- 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
-- split the numbers but what do they mean and how to calc?
-- documentation says calc this, but calc how, what is it showing me?
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 =
{
["adr"] = {["M"] = 0,["X"] = 4,["B"] = 1,},
["age"] = {["M"] = 0,["X"] = 6,["B"] = 0,},
["ahn"] = {["M"] = 0,["X"] = 6,["B"] = 0,},
["ara"] = {["M"] = 0,["X"] = 4,["B"] = 0,},
["arm"] = {["M"] = 0,["X"] = 4,["B"] = 0,},
["bin"] = {["M"] = 0,["X"] = 4,["B"] = 4,},
["cem"] = {["M"] = 0,["X"] = 4,["B"] = 4,},
["dir"] = {["M"] = 0,["X"] = 4,["B"] = 2,},
["dob"] = {["M"] = 0,["X"] = 4,["B"] = 0,},
["dod"] = {["M"] = 0,["X"] = 4,["B"] = 0,},
["dst"] = {["M"] = 0,["X"] = 4,["B"] = 4,},
["dup"] = {["M"] = 0,["X"] = 4,["B"] = 0,},
["era"] = {["M"] = 0,["X"] = 1,["B"] = 0,},
["err"] = {["M"] = 0,["X"] = 4,["B"] = 0,},
["erx"] = {["M"] = 0,["X"] = 1,["B"] = 0,},
["fct"] = {["M"] = 0,["X"] = 8,["B"] = 0,},
["fid"] = {["M"] = 0,["X"] = 6,["B"] = 0,},
["gen"] = {["M"] = 0,["X"] = 6,["B"] = 0,},
["gli"] = {["M"] = 0,["X"] = 4,["B"] = 0,},
["gpi"] = {["M"] = 0,["X"] = 4,["B"] = 4,},
["gps"] = {["M"] = 0,["X"] = 1,["B"] = 4,},
["iid"] = {["M"] = 0,["X"] = 6,["B"] = 0,},
["lbl"] = {["M"] = 0,["X"] = 4,["B"] = 0,},
["loc"] = {["M"] = 0,["X"] = 4,["B"] = 4,},
["mdt"] = {["M"] = 0,["X"] = 4,["B"] = 0,},
["mml"] = {["M"] = 0,["X"] = 4,["B"] = 0,},
["nam"] = {["M"] = 0,["X"] = 4,["B"] = 1,},
["nct"] = {["M"] = 0,["X"] = 8,["B"] = 0,},
["ord"] = {["M"] = 0,["X"] = 4,["B"] = 0,},
["oth"] = {["M"] = 0,["X"] = 4,["B"] = 0,},
["plc"] = {["M"] = 0,["X"] = 4,["B"] = 0,},
["ptg"] = {["M"] = 0,["X"] = 4,["B"] = 0,},
["ptr"] = {["M"] = 0,["X"] = 1,["B"] = 0,},
["rgn"] = {["M"] = 0,["X"] = 4,["B"] = 4,},
["rlt"] = {["M"] = 0,["X"] = 4,["B"] = 4,},
["rmn"] = {["M"] = 0,["X"] = 6,["B"] = 0,},
["rnk"] = {["M"] = 0,["X"] = 4,["B"] = 0,},
["rte"] = {["M"] = 0,["X"] = 4,["B"] = 2,},
["sdf"] = {["M"] = 0,["X"] = 4,["B"] = 0,},
["sep"] = {["M"] = 0,["X"] = 4,["B"] = 0,},
["set"] = {["M"] = 0,["X"] = 6,["B"] = 0,},
["sex"] = {["M"] = 0,["X"] = 1,["B"] = 0,},
["src"] = {["M"] = 0,["X"] = 4,["B"] = 0,},
["svc"] = {["M"] = 0,["X"] = 4,["B"] = 2,},
["tim"] = {["M"] = 0,["X"] = 3,["B"] = 0,},
["trk"] = {["M"] = 0,["X"] = 4,["B"] = 0,},
["war"] = {["M"] = 0,["X"] = 4,["B"] = 0,},
["web"] = {["M"] = 0,["X"] = 4,["B"] = 4,},
["yr"] = {["M"] = 0,["X"] = 1,["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