O$4 Set reference question

Michael Monschau michael at brainydata.co.uk
Tue Mar 12 19:45:31 EDT 2013

Hi Michael,

When setting a reference to $cwind.iListA.$ref, the item reference will store a reference to the notation string $cwind.iListA because of the trailing $ref, not an item reference to the actual list data. The notation internally actually translates to the notation for current_window.instance_vars.var_number. So if iListA was the 21st instance variable at the time you set the item reference, the item reference stores $cwind.$ivars.21. 

If you than view the item reference within a different context it will show you instance variable 21 of the current context. This will be OK as long as that item reference is only used with that window. But if you were to pass it to a method belonging to another class instance, your item reference will point to the 21st instance var of that class instance.

Just drop the $ref and you should be fine. 
I hope this makes sense.


Michael Monschau (Director)
Brainy Data Limited

Reply To: michael at brainydata.co.uk
Phone: +44 (0)870 474 0708
Web: www.brainydata.co.uk the home of Omnis Components and Developer Services

On 12 Mar 2013, at 20:34, Michael Rowan wrote:

> Hi
> I have a window that has several instance variables of type list, or row.
> Some of the subwindows need to access those lists or rows, so they include matching instance variables of type item ref, and a method:
> $initialise
> Set reference iListA to $cwind.iListA.$ref
> etc
> This works perfectly well.
> The odd thing is that this code, following a breakpoint, sometimes reads:
> $initialise
> Set reference iListA to $cwind.$ivars.21.$ref
> or Set reference iListA to $cwind.$ivars.iListA.$ref
> This does not appear to be harmful, but I wonder if there is a problem waiting for its chance to create havoc?
> Michael Rowan
> mike.rowan at internode.on.net
> 11 Kingscote Street
> South Australia 5014
> tel 618 8240 3993
> mob 0417 812 509
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com

More information about the omnisdev-en mailing list