Announcement

Collapse
No announcement yet.

Collections?

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

  • Collections?

    Is there an easy example to show me how to prepare a collection?

    I would like to create an 'items' propery.
    Not sure if that is handy anyway, afaik foreach() is not supported at this time(?)

    Or should i use an item method with index?

    I would have a limitted collection so optimized enumeration is not that required at this time.
    Though i find real collections the better thing to use.
    hellobasic

  • #2
    You can use the Dictionary object to build collections.
    Forum: http://www.jose.it-berater.org/smfforum/index.php

    Comment


    • #3
      I guess this would result in a different type..
      Some object storage which needs to be casted.

      I'll go for a simple object array or similar..

      IDictionary also gives a lot of .NET examples
      hellobasic

      Comment


      • #4
        Code:
        class myclass
        
              instance myCol() 	  as iCollection
              instance m_ColCount as Long
        
              class method Create()
        	  m_ColCount = 0
              end method 
        
              interface iMyclass
              inherit IDispatch
        
        
              method AddData(ByVal ClsCol as iCollection)
        
        	  If IsObject(ClsCol) Then
        
                     Incr m_ColCount
        
        	     Redim Preserve m_Col(m_Colcount) as iCollection
        
                     m_Col(m_ColCount - 1) = ClsCol
        
                  End If
        
              end method 
              
              end interface
        
        end class
        So here we are, this is the end.
        But all that dies, is born again.
        - From The Ashes (In This Moment)

        Comment


        • #5
          A collection is not a simple array.
          hellobasic

          Comment


          • #6
            Edwin,

            Ok, I thought you were implementing an 'collection' like functionality in a class.
            So here we are, this is the end.
            But all that dies, is born again.
            - From The Ashes (In This Moment)

            Comment


            • #7
              A collection is not a simple array.
              Since we are talking COM here, what Steven posted is not a collection, but
              the data managed by the collection object can take any form even an array.
              The collection object should implement the following methods:

              Count
              Item
              NewEnum(0xFFFFFFFC)
              Add
              Remove
              Clear

              Relatively easy to do using low-level COM. I think it is doable in PB9, but the
              IDL file will have to be coded by hand.
              Dominic Mitchell
              Phoenix Visual Designer
              http://www.phnxthunder.com

              Comment


              • #8
                Thanks,
                At this moment to much work for this little task.
                To busy
                hellobasic

                Comment


                • #9
                  Originally posted by José Roca View Post
                  You can use the Dictionary object to build collections.
                  Is this the dictionary in scrrun.inc ?
                  (Microsoft Scripting Runtime)

                  ?
                  hellobasic

                  Comment


                  • #10
                    Hmm, only when office is installed..
                    hellobasic

                    Comment


                    • #11
                      Hmm, only when office is installed..
                      If it is not installed, you can do it yourself:

                      Windows Script 5.6 for Windows XP and Windows 2000
                      http://www.microsoft.com/downloads/d...displaylang=en

                      Windows Script 5.7 for Windows XP
                      http://www.microsoft.com/downloads/d...displaylang=en
                      Forum: http://www.jose.it-berater.org/smfforum/index.php

                      Comment

                      Working...
                      X