O$ 5: $methodtext.$assign throws error 25216 (attempt to use instance/task var…)
Hi fellas,
Thanks for all the replies.
After some further debugging, I have noticed that the error is somehow
related to a Headed List Box in a Subwindow (of the window superclass).
The $dataname of that Headed List Box is set to an Instance Variable
of the Subwindow. If I leave the $dataname blank, no error is thrown.
The really weird thing is, that the error is only thrown when the
window is still open in design mode in the background. Once you close
the design window, it all works fine.
So it’s not a big issue, since we’ll never encounter it in a runtime.
Maybe it’s a little bug in Studio? I have sent a test library to Omnis
Support, I’ll let you know what comes out of it.
Cheers,
Nick
On 8 Jun 2017, at 17:47, Udo Sonnabend wrote:
> Hi,
>
>
> I’m not sure where your error comes from, but as I read you want to
> add dynamical fields to your window. May be the following could be a
> workaround for you.
>
>
> You could try to use prototype objects. Put somewhere on a one window
> used as component store your desired field with its methods behind.
>
>
> Set up a reference to that field:
>
>
> Set reference myPrototypeFieldRef to
> $classes.MyComponentStoreWindow.$objs.MyField
>
>
> at runtime do:
>
>
> $cwind.$objs.$add(myPrototypeFieldRef,…)
>
>
> I’m not in office may be you have to check the parameters above. We
> have lots of windows completely constructed with such prototypes. Very
> handy and fast.
>
>
> Regards, Udo.
>
> ________________________________
> Von: omnisdev-en <omnisdev-en-bounces@lists.omnis-dev.com> im Auftrag
> von Rudolf Bargholz <rudolf@bargholz.ch>
> Gesendet: Donnerstag, 8. Juni 2017 15:50:30
> An: OmnisDev List – English
> Betreff: AW: O$ 5: $methodtext.$assign throws error 25216 (attempt to
> use instance/task var…)
>
> Hi Nick,
>
> Are you sure the $cwind is correct in your context?
> Could it be, that you ought to be using $cinst instead of $cwind?
>
> Regards
>
> Rudolf Bargholz
>
> —–Ursprüngliche Nachricht—–
> Von: omnisdev-en [mailto:omnisdev-en-bounces@lists.omnis-dev.com] Im
> Auftrag von Nick Renders
> Gesendet: Donnerstag, 8. Juni 2017 15:24
> An: OmnisDev List – English <omnisdev-en@lists.omnis-dev.com>
> Betreff: Re: O$ 5: $methodtext.$assign throws error 25216 (attempt to
> use instance/task var…)
>
> Hi Peter,
>
> Thank you for testing this out yourself.
>
> I don’t think the problem is with the Item Reference variable.
> When I test the code in a new window class, I’m not getting any errors
> either. It’s only when I set the superclass that the error appears. So
> I’m guessing the problem lies somewhere in the $control method of my
> window superclass.
>
> I’ll do some further digging.
>
> Cheers,
>
> Nick
>
>
>
>
> On 8 Jun 2017, at 13:55, Peter van Rooij wrote:
>
>> Hello Nick
>>
>> I did some tests.
>>
>> When I do get an error it is on the first line of code . lRef will be
>> NULL and consequently the second line of the code doesn’t work
>> then..
>> I never get an error the first time I run the code.
>> Only when I execute the same code again. And that is understandable,
>> because a method with that name already exists (from the first time).
>> I still get the OK message because I am calling an existing method.
>>
>> Regards
>>
>> Peter
>>
>>
>>> On 8 jun. 2017, at 12:19, Nick Renders <omnis1@arcict.com> wrote:
>>>
>>> Hi gang,
>>>
>>> We have a window where we dynamically add fields. Some of these
>>> fields require some code in their $event method, so we add that as
>>> well.
>>>
>>> Since we started using an error handler, I have noticed that
>>> assigning the $methodtext property throws error 25216 :
>>> Attempt to use an instance or task variable when no instance exists.
>>>
>>> The code actually works, but for some reason I keep getting the
>>> 25216
>>> error for every $methodtext.$assign .
>>>
>>> Example code:
>>>
>>> Do $cwind.$objs.txtField1.$methods.$add(“$test1”) Returns lRef
>>> Do lRef.$methodtext.$assign(“OK message {Hello world}”)
>>> Do $cwind.$objs.txtField1.$test1()
>>>
>>>
>>> Anyone have any idea what might be causing this?
>>>
>>>
>>> Best regards,
>>>
>>> Nick Renders
>>>
>>> _____________________________________________________________
>>> Manage your list subscriptions at lists.omnis-dev.com
>>
>>
>> _____________________________________________________________
>> Manage your list subscriptions at lists.omnis-dev.com
>
> _____________________________________________________________
> Manage your list subscriptions at lists.omnis-dev.com
> _____________________________________________________________
> Manage your list subscriptions at lists.omnis-dev.com
> _____________________________________________________________
> Manage your list subscriptions at lists.omnis-dev.com
_____________________________________________________________
Manage your list subscriptions at lists.omnis-dev.com