James,

I am going to keep all of these threads, print them out, and go over
them multiple times until I begin to grasp it all. I guess I won't be
learning CFAJAX until I get CFC's down, which is proving to be quite a
task and very lengthy process.

Thanks again and again!

-Aaron

"To instantiate or not to instantiate, that is the question." - 21st
Century Shakespeare

On 2/16/06, James Holmes <[EMAIL PROTECTED]> wrote:
> No, for the moment, forget THIS.
>
> > <cfargument name="this.name" type="string" default="">
> > <cfset variables.name = this.name>
>
> should be
>
> <cfargument name="name" type="string" default="">
> <cfset VARIABLES.name = ARGUMENTS.name>
>
> The life cycle of the instance depends on where you put it.
> Instantiate it in the session scope, it lasts as long as the session.
> Similar for the application scope.
>
> The use of THIS is to make this bit work:
>
> <cfset myObjectInstance = CreateObject("component","someCFC").init()>
>
> Inside that, the init() method returns THIS
>
> <cffunction name="init">
>   <!-- set defaults, whatever --->
>   <cfreturn THIS>
> </cffunction>
>
> That's the only time you need to use THIS in the whole component.
>
> On 2/17/06, Aaron Roberson <[EMAIL PROTECTED]> wrote:
> > > The only use for THIS in an OO-based component is to return THIS at
> > > the end of the constructor. That returns the entire component for use
> > > as an instance.
> >
> > In Java, the constructer is for providing arguments with default
> > values. These default values can be the ones that are automaticly
> > assigned to each corresponding data type, or if you create a
> > constructer method it will be the values you specify.
> >
> > > The properties will be in the VARIABLES scope; they can be used via
> > > getter and setter methods. This is where the ARGUMENTS scope comes in
> > > - the setter methods take an argument, check it for validity and then
> > > set a value in the VARIABLES scope. The VARIABLES scope remains
> > > between method calls, acting as storage within the instance.
> >
> > So within my setter method I would do something like the following:
> >
> > <cfargument name="this.name" type="string" default="">
> > <cfset variables.name = this.name>
> >
> > The intention would be to make the "name" property persist across
> > method calls? I don't think I really understand what that means. I am
> > thinking in terms of sessions and applications but I don't think their
> > related. If I assign something to the session scope, the variable
> > remains the same throught the entire session unless it is changed by
> > another assignment. If an object is instantiated, all properties in
> > the variable scope will remain the same on the calling page, but what
> > about on other pages? What is the life cycle of an instance?
> >
> > Sorry for all the questions... I hope someone else relieves you from
> > doing all the work of saving me from despair...
> >
> > Thanks so much,
> > Aaron
> >
> > On 2/16/06, James Holmes <[EMAIL PROTECTED]> wrote:
> > > The only use for THIS in an OO-based component is to return THIS at
> > > the end of the constructor. That returns the entire component for use
> > > as an instance.
> > >
> > > The properties will be in the VARIABLES scope; they can be used via
> > > getter and setter methods. This is where the ARGUMENTS scope comes in
> > > - the setter methods take an argument, check it for validity and then
> > > set a value in the VARIABLES scope. The VARIABLES scope remains
> > > between method calls, acting as storage within the instance.
> > >
> > > On 2/17/06, Aaron Roberson <[EMAIL PROTECTED]> wrote:
> > > > What about the constructor function? Shouldn't I set the properties in
> > > > the THIS scope when initializing a component?
> > > >
> > > > Also, what is the difference between the variables scope and the
> > > > arguments scope withing a method? I have seen properties defined using
> > > > the cfargument tag referenced in the method using both the arguments
> > > > scope and the variables scope.
> > >
> > > --
> > > CFAJAX docs and other useful articles:
> > > http://jr-holmes.coldfusionjournal.com/
> > >
> > >
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232674
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to