realbasic-nug
[Top] [All Lists]

Re: accessing nil variant properties

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: accessing nil variant properties
From: William Squires <wsquires at satx dot rr dot com>
Date: Mon, 31 Jan 2005 10:08:02 -0600
Cc:
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <80CE0506-7309-11D9-8308-000D933D1C6E at yahoo dot de>

On Jan 30, 2005, at 3:54 PM, Dr.Georg Christmann wrote:

Hi all,

Sorry if this has already been discussed.

Regarding variants i came across the following behaviour that I believe is odd:

in an empty project I drag three pushbuttons.

pushbutton1.Action:
        dim v as Variant
        msgBox v.StringValue

pushbutton2.Action:
        dim v as Variant
        v=nil
        msgBox v.StringValue

pushbutton3.Action:
        dim v as Variant
        v="a"
        msgBox v.StringValue

In case 3 I get a msgBox showing an "a", as expected.
In case 1 and 2 I would have expected a nil object exception, instead I get an "empty" msgBox. Even the debugger says v is nil in case 1 and 2.

Is this intended behaviour?
If not: could this be related to bugreports "jwzbbxgp" or "wgfrzrru" ?

It would be if variants were references in your context. I believe though, that they're a data type (like Integer, String, Boolean, etc...) and - as such - is more like the '\0' character in C. Try assigning the variant to an object reference, then use it and watch what happens!


Thx.

Georg

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


William H Squires Jr
wsquires at satx dot rr dot com dot nospam <- remove the .nospam

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>