Kirk, My apologies. I mistyped the offending lines!
The lines causing the error dereference the pointers. So they are $to.toDate->:=$from.toDate-> $to.toAge->:=$from.toAge-> etc. The curious things are that (a) the dereferenced pointers do definitely point at variables of the same type; (b) although I get an alert with the error message, the assignment does in fact work (that is, if I click “continue”, everything is exactly as it should be when the method completes). I can get round the error by using pointer variables: $pTo:=$to.toDate $pFrom:=$from.toDate $pTo->:=$pFrom-> which works fine. I just don’t understand the actual error message, since I’m not doing what it’s accusing me of doing. Jeremy > On 25 Feb 2019, at 16:47, Kirk Brooks via 4D_Tech <[email protected]> > wrote: > > Jeremy, > Since you are writing the data to an object what's the value of using the > pointer? Why not just write the data? > > In fact, since TCMGetRow looks like it is simply holding the data for the > transfer you could make it a loop: > > For($i;1;number of objects) > > $o["_"+string($i)]:=Object get pointer(Object named;$root+string($i))-> > > End for > > This way you don't need to care about the data type assuming the 2 objects > actually have the same typed objects for each index. > > But to specifically answer your question I would take a look at the way the > date value is stored in your object and then how you reference it. There's > another post about dates and objects that sounds on point with what you are > doing. > > > On Mon, Feb 25, 2019 at 7:37 AM Jeremy Roussak via 4D_Tech < > [email protected]> wrote: > >> I have a form which shows a variable number of rows of numbers and text. >> The rows are created using OBJECT DUPLICATE on each of the half-dozen items >> in the row (yes, using a collection listbox might be a better way do to it, >> but I wrote this code a while ago). If a row is deleted, I need to copy the >> contents of the rows beneath it upwards. >> >> >> So I have a method which creates an object and populates it with pointers >> to the created variables. I call this to get a set of pointers to one row, >> then again to get a set to the next row, and then I copy. >> >> I start >> >> C_OBJECT($from;$to) >> $from:=TCMGetRow($start) >> >> then in a loop, >> >> $to:=$from >> $from:=TCMGetRow($i) >> >> $to.toDate:=$from.toDate >> $to.toAge:=$from.toAge >> etc. >> >> >> >> TCMGetRow has >> >> C_OBJECT($0;$o) >> C_LONGINT($1;$row) >> $row:=$1 >> >> C_TEXT($root) >> >> $root:="vr"+String($row)+"c" >> $o:=New object >> >> $o.toDate:=OBJECT Get pointer(Object named;$root+"0") >> $o.toAge:=OBJECT Get pointer(Object named;$root+"1") >> etc >> >> $0:=$o >> >> I’m getting the message in the subject line in the main loop for each >> assignment, but only when compiled; interpreted, it works fine. In the >> debugger, the pointers in $to and $from point to variables of the same type. >> >> I’m quite new to extensive use of objects. What am I missing? >> >> Jeremy >> >> ********************************************************************** >> 4D Internet Users Group (4D iNUG) >> Archive: http://lists.4d.com/archives.html >> Options: https://lists.4d.com/mailman/options/4d_tech >> Unsub: mailto:[email protected] >> ********************************************************************** > > > > -- > Kirk Brooks > San Francisco, CA > ======================= > > What can be said, can be said clearly, > and what you can’t say, you should shut up about > > *Wittgenstein and the Computer * > ********************************************************************** > 4D Internet Users Group (4D iNUG) > Archive: http://lists.4d.com/archives.html > Options: https://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:[email protected] > ********************************************************************** ********************************************************************** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:[email protected] **********************************************************************

