Inserting columns into an edittable (OpenInsight 64-bit)
At 04 SEP 2023 11:29:16PM Matthew Crozier wrote:
I thought I read somewhere that in OI10 you can dynamically insert columns into an edittable without having to destroy the control and recreate it with a new structure. Is there such a method?
Cheers, M@
At 05 SEP 2023 04:51AM Carl Pates wrote:
Hi M@
Inserting columns into EditTables has always been supported via the INSERTCOL message in previous version of OI.
In v10 we still support that method but I added a new one called INSERTCOLX that supports the v10 options better.
Syntax is:
insertedPos = exec_Method( edtID, "INSERTCOLX", insertPos, colStruct )InsertPos can be "-1" to mean "append".
The inserted position is returned or "0" if a failure occurred.
ColStruct is an @fm-delimited dynamic array as per PS_EDITTABLE_EQUATES:
// INSERT column equates - structure definition for inserting columns // // <1> Header Text (v9 COLLABEL) // <2> Style (v9 COLSTYLE) ETCLS_ styles (or DTCS_ for v9) // <3> Data Length (v9 COLCHARS) // <4> Display Width (v9 COLWIDTH) // <5> Header Style ETCHS_ styles // <6> Header Font // <7> Header ToolTip // <8> Cell DropDown List // <9> Cell Font // <10> Cell ToolTip // <11> Cell CueBanner // <12> Cell EditMask (@vm delimited) // <13> Cell ValidChars // <14> Cell ButtonText/Width (@vm delimited)The difference between INSERTCOL and INSERTCOLX is that the former expects v9 "DTCS_" styles, while the latter expects v10 "ETCLS_" styles (as per the equates).
If you're prefer to work with arrays rather than style bits you can use an @vm'd array for info for the style (<2>) and headerStyle (<5>) - again these are defined in PS_EDITTABLE_EQUATES.
Cheers,
At 05 SEP 2023 06:12PM Matthew Crozier wrote:
Inserting columns into EditTables has always been supported via the INSERTCOL message in previous version of OI.
Thanks Carl!
Gosh, I don't know how I missed this - must be looking at some very old code..
Cheers, M@