Item Reference Won't Work

Doug Easterbrook doug at artsman.com
Sun Oct 9 15:15:27 UTC 2022


sounds like you are tracking the reference to the window you just opened.     I can’t comment on your code.  but we do this

in the window we have an instance variable called

iWindowRef 
- defined as  itemref 
- initial value/calc  is   $cinst().$ref


at the end of the windows $construct, we simply have a 

quit method   iWindowRef

that way, the window has its own reference to itself in an easy to see variable.     we could, of course, refer to $cinst().$ref within the window, but I like the visibilty of ‘iWindowRef’ to the code within the window.     its just our standard.


this conforms to the documentation

do $clib.$windows.$open(‘myWindow’,kwindowcenterrelarive,params) … returns itemref



so, you could try opening your window as 


do $clib.$windows.$open(‘myWindow’,kwindowcenterrelarive,params) … returns tWindowRef




then you have a reference to the window you just opened in your task var.


------

I can’t comment on your line of code as I didn’t try it.

> Set reference tWindowRef to lWindowRef.$ref().

that might work as

> Set reference tWindowRef to lWindowRef().$ref

or just

> Set reference tWindowRef to lWindowRef








Doug Easterbrook
Arts Management Systems Ltd.
mailto:doug at artsman.com
http://www.artsman.com
Phone (403) 650-1978

> On Oct 9, 2022, at 7:56 AM, Das Goravani <goravanis at gmail.com> wrote:
> 
> Doug,
> 
> I want to transfer the value from the local item ref to a task item ref for the sake of broader scope.
> 
> You mentioned the local ref will go out of scope when that object is finished. Yes, true, but isn’t the value actually transferred if say you 
> 
> Set reference tWindowRef to lWindowRef.$ref().  ??????
> 
> If I do that, isn’t the ref fully transferred to the Task Var?
> 
> The local var is RETURNED by the opening of a window using $open()
> 
> I tried putting the task var in the RETURNS slot and it was not set by the opening of the window. So the task var simply isn’t working. 
> 
> I will try making it local, then dragging it to task to see if it will work that way. 
> 
> Thanks
> 
> Das
> Richard
> 
> 
> 
>> On Oct 9, 2022, at 10:47 AM, Doug Easterbrook via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
>> 
>> make a new local  ‘itemref’ variable called.   ‘mytestref’  and try assign it
>> 
>> set reference mytestref to lWindowRef
>> 
>> if that works, drag the local variable from the local variable pane to the task var variable and try running the same line of code
>> 
>> 
>> if this works, then you know you can assign an item ref to a task var.    and not its a matter of deciding if the oroginal task var is not defined the way you thought it was … or if the line of code is not tokenized properly.       
>> 
>> for tokenization, retype the line of code and then see if that works.
>> 
>> 
>> if it doesn’t then you are stuck.
>> 
>> 
>> 
>> also,  why would you want to assign a local item ref to a task var?     as soon as the local method is done with, then the taskvar has no valid reference.    maybe thats an issue as the variable is out of scope and omnis knows is??
>> 
>> 
>> 
>> 
>> 
>> 
>> Doug Easterbrook
>> Arts Management Systems Ltd.
>> mailto:doug at artsman.com
>> http://www.artsman.com
>> Phone (403) 650-1978
>> 
>>> On Oct 9, 2022, at 6:25 AM, Das Goravani <goravanis at gmail.com> wrote:
>>> 
>>> 
>>> Studio 4.3
>>> Using the VCS
>>> Windows
>>> 
>>> I declare an Item Reference as a Task Variable
>>> I use it in a line of code
>>> In execution it stops on the line where I try to Set the Reference and says "Attempt to assign a reference to a variable that is not an item reference"
>>> 
>>> It is an Item Ref. 
>>> I am assigning it from another ref that is a local variable, my item ref. Is a task variable
>>> 
>>> As in
>>> 
>>> Set reference tWindowRef to lWindowRef
>>> 
>>> Why is it saying it is not an item reference?
>>> 
>>> I have the Startup_task checked out of the VCS, alone with another class that has the code in it. 
>>> 
>>> I have a feeling that it is something else, and it is only saying that out of some default error checking code they have in Omnis
>>> 
>>> Does anybody have any idea what I might try, how I can make this "go ahead" and start working?
>>> 
>>> Thanks
>>> 
>>> Das Goravani
>>> Richard Wurst (I’m going back to my birth name)
>>> _____________________________________________________________
>>> Manage your list subscriptions at https://lists.omnis-dev.com
>>> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 
>> 
>> _____________________________________________________________
>> Manage your list subscriptions at https://lists.omnis-dev.com
>> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 
> 



More information about the omnisdev-en mailing list