Re: WOComponents, Packages, and Protected variables.

From: Steven Mark McCraw (mar..luecollarsoftware.com)
Date: Thu Aug 16 2007 - 11:06:37 EDT

  • Next message: Kieran Kelleher: "Re: WOComponents, Packages, and Protected variables."

    Hey David,

    You just create a NSMutableDictionary in a component that you
    subclass in all your "working" components. I call mine 'ph' (short
    for placeholder, in my mind) because I want it to be short since I'll
    be accessing it a lot.

    So you declare the variable in the superclass, create setters and
    getters for it, and then in the constructor do:

    setPh(new NSMutableDictionary());

    Now every time you need a variable to use as the "item" binding in a
    repetition, for example, you won't need to declare it in the
    component. You can just bind item to ph.whateverYouWantToCallIt

    If for some reason you need to reference it in your code elsewhere,
    you just say (MyClass)ph.valueForKey("whateverYouWantToCallIt"). I
    find that if you're going to be accessing it in your code a lot, this
    becomes a pain, so for those variables, I go ahead and declare local
    ivars and accessors.

    Mark

    On Aug 16, 2007, at 10:59 AM, David Avendasora wrote:

    > This idea intrigues me. Can you explain further? Would this be a
    > good "Best Practice" to follow?
    >
    > I will put all this in the WOProject/WOLips/Tutorials/Editing
    > WOComponents Page
    >
    > Thanks!
    >
    > Dave
    >
    >
    > On Aug 16, 2007, at 9:13 AM, Guido Neitzer wrote:
    >
    >> I have a "dynamicBindings" NSMutableDictionary on my component
    >> superclass,
    >
    >



    This archive was generated by hypermail 2.0.0 : Thu Aug 16 2007 - 11:07:46 EDT