Announcement

Collapse
No announcement yet.

Property returniong type ok, usage not

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Property returniong type ok, usage not

    I get this error:

    PowerBASIC for Windows
    PB/Win Version 9.00
    Copyright (c) 1996-2008 PowerBasic Inc.
    Venice, Florida USA
    All Rights Reserved

    Error 426 in ----
    Variable expected
    Line 802: R = Me.Size

    Code:
            Property Get Size() As RECT
                Local R As RECT
                Property = R
            End Property
    
            Method Hello() As Long
                Local R As RECT
                R = Me.Size()
            End Method
    hellobasic

  • #2
    hI Edwin,

    Looking at your code, the R in the Get Property will not contain any
    values since R is locally defined and not an Instance veriable. Is this
    what you want ?

    Ok, then to the meat of the problem.

    Try Lset R = me.Size()

    Cheers
    Steven
    So here we are, this is the end.
    But all that dies, is born again.
    - From The Ashes (In This Moment)

    Comment


    • #3
      Get Size suggest it's allowed to return a RECT variable.
      hellobasic

      Comment


      • #4
        And it is, but you have to use TYPE SET or LSET to assign it, i.e. TYPE SET R = Me.Size().
        Forum: http://www.jose.it-berater.org/smfforum/index.php

        Comment


        • #5
          Hmm, a bit like peek and poke isn't?
          Oh well, i'll reconsider using a property then.
          (Usually i return it byref)
          hellobasic

          Comment


          • #6
            A bit of annoying, now i have an object which i may not pass directly.

            In an interface i have a property returning another interface (think of parent) and i can use it with OOP syntax.
            Now i wish to pass this parent object to a function which is declared byref like:

            Function Hello( ByRef oParent As IMyParentInterface ) and get a similar error.
            If i use a variable and pass that it is ok like:

            local oParent As IMyParentInterface
            oParent = IChild.parent
            Hello( oParent )

            That is overhead.
            hellobasic

            Comment

            Working...
            X