clea > >local loF >loF = createobject("flag_handler") >loF.__TstClass() > >define class flag_handler as custom > __cFlagchar = 0h + space(40) > __lRecChanged = .f. && to check if replacing in record needs to be done on skipping > > function init() > *** slower, but MUCH cleaner, as it uses only official user methods > *** instead of bitclear(this.__cFlagchar,0, LEN(this.__cFlagchar)*8) > for lnRun = 1 to len(this.__cFlagchar)*8 > this.SetFlag(m.lnRun, .f.) > next > this.__lRecChanged = .f. > return dodefault() > > function GetFlag(tnFlagNum) > return !empty(bittest(this.__cFlagchar, m.tnFlagNum - 1)) && 0-based this.__cFlagChar as in C usually happening > > function FlipFlag(tnFlagNum) > this.__lRecChanged = .t. > this.__cFlagchar = bitnot(this.__cFlagchar, m.tnFlagNum - 1) > > function SetFlag(tnFlagNum, tlFlag) > this.__lRecChanged = .t. > if empty(m.tlFlag) > this.__cFlagchar = bitclear(this.__cFlagchar, m.tnFlagNum - 1) > else > this.__cFlagchar = bitset(this.__cFlagchar, m.tnFlagNum - 1) > endif > > function __ChkFlag(tnFlagNum, tlShouldBe) > local llErg > llErg = this.GetFlag(m.tnFlagNum) > if pcount()=1 > ? m.tnFlagNum, m.llErg > else > ? m.tnFlagNum, m.llErg, m.tlShouldBe > endif > > function __TstClass() > > local lnTest1, lnTest2, llFlag1, llFlag2 > lnTest1 = 22 > lnTest2 = 42 > > = this.__ChkFlag(m.lnTest1) > = this.__ChkFlag(m.lnTest2) > > llFlag1 = .t. > = this.SetFlag(m.lnTest1, m.llFlag1) > = this.__ChkFlag(m.lnTest1, m.llFlag1) > > = this.SetFlag(m.lnTest1, m.llFlag2) > = this.__ChkFlag(m.lnTest1, m.llFlag2) > > = this.SetFlag(m.lnTest2, m.llFlag1) > = this.__ChkFlag(m.lnTest2) > > = this.__ChkFlag(m.lnTest1) > = this.FlipFlag(m.lnTest1) > = this.__ChkFlag(m.lnTest1) > = this.FlipFlag(m.lnTest1) > = this.__ChkFlag(m.lnTest1) > >enddefineThank you very much for the code.