SPONSORS:






User Tag List

Results 1 to 8 of 8
  1. #1
    Member
    Join Date
    Jan 2003
    Location
    Caribou, ME, USA
    Posts
    38
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using the Set accessor for object in a collection (list)

    Has anyone tried using the Set accessor for an object in a collection? I have and I get a syntax error. I'm wondering if anyone else has seen this and/or could offer advice. Here's a quick example of what I'm doing...

    As you can see, the Get accessor and method calls to the object in the collection work fine. I've even tested to make sure that we're working on the same object in memory by having MyMethod set the Name property of the object and printing it both ways to make sure they match.

    The only problem I'm having is with the Set accessor. I get a syntax error on the assignment operator (=) every time. Has anyone run into this before? Thoughts?

    -Greg
    Greg
    ATX II, LLC
    You wrote [i]what</I] in 4Test?!?

  2. #2
    Member
    Join Date
    Jun 2001
    Location
    Bedford, MA, USA
    Posts
    85
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using the Set accessor for object in a collection (list)

    Greg,
    I create lists of objects all the time and have never had a problem with the Set accessor.
    See the attached script file for an example.

    I wonder if it has to do with the way your properties are defined. Please post your cCollection class so we can take a look.
    - Jim

    ------------------

  3. #3
    Member
    Join Date
    Jan 2003
    Location
    Caribou, ME, USA
    Posts
    38
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using the Set accessor for object in a collection (list)

    You should be able to cut-and-paste this directly into the IDE and see the error. Note that we have the ActiveX extensions turned on.

    ------------------
    Greg
    ATX II, LLC
    You wrote [i]what</I] in 4Test?!?

  4. #4
    Member
    Join Date
    Jan 2003
    Location
    Caribou, ME, USA
    Posts
    38
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using the Set accessor for object in a collection (list)

    By the way, how the heck do you create CR/LF inside of CODE blocks? Every time I put code inside those UBB blocks, it removes the vertical whitespace. Anyone?

    ------------------
    Greg
    ATX II, LLC
    You wrote [i]what</I] in 4Test?!?

  5. #5
    Member
    Join Date
    Jan 2003
    Location
    Caribou, ME, USA
    Posts
    38
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using the Set accessor for object in a collection (list)

    &lt;cue the chirping crickets&gt;
    Greg
    ATX II, LLC
    You wrote [i]what</I] in 4Test?!?

  6. #6
    Member
    Join Date
    Jun 2001
    Location
    Bedford, MA, USA
    Posts
    85
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using the Set accessor for object in a collection (list)

    Greg,
    I've been looking at (and playing with) your code. Here are my findings:
    1) I don't know why it's failing, but Silk must have a different order of operations for the left vs right side of an equation.
    2) The code line:
    Returns.Item(3).ReturnName = "Set via..."
    does not even COMPILE in the 4test editor.
    3) A workaround to the above line is:
    window wTemp = Returns.Item(3)
    wTemp.ReturnName = "Set via..."
    4) You probably have good reasons, but I don't see why the created objects (CReturn_Base) need to reside in a collection object (CReturns_Base). The collection object essentially imitates the functionality of a LIST e.g. adding, indexing, removing, so why not just put them into a list of window.
    5) I've attached two variations of your work (I think). In both cases I use a LIST instead of a collection object - thus avoiding the troublesome Set accessor syntax.
    Note the second attachment uses a cool function to dynamically instanciate an object of any class.
    - Jim

    ------------------

  7. #7
    Member
    Join Date
    Jan 2003
    Location
    Caribou, ME, USA
    Posts
    38
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using the Set accessor for object in a collection (list)

    I appreciate the Sanity Check on my code, Jim. You're right, the reasons for the collection run deep and wide. Looks like the next step is knocking on Segue's door to see what they say. I'll let you know if I hear anything back from them. Thanks again!

    -Greg


    BTW, I hope I didn't come off as a jerk with my prior message (crickets). I just wanted to bump the topic up on the list. I sincerely appreciate everyone's time.
    Greg
    ATX II, LLC
    You wrote [i]what</I] in 4Test?!?

  8. #8
    Member
    Join Date
    Jun 2001
    Location
    Bedford, MA, USA
    Posts
    85
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using the Set accessor for object in a collection (list)

    Greg,
    Good luck with Segue. Keep us posted on what they say.
    Meanwhile I thought of another workaround, (perhaps you've already considered this as well). Why not have a method in CReturns_Base to set property values?

    code:
    ---------------------------------------------
    private winclass CReturns_Base
    {
    ...
    void SetProperty(integer iObjIndex, string sPropertyName, ANYTYPE aValue)
    {
    this.lwObjects[iIndex].@sPropertyName = aValue;
    }
    }
    ---------------------------------------------

    - Jim



    ------------------

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 11:11 PM.

Copyright BetaSoft Inc.