You do mean use the var keyword instead of using the variables scope?  The
variables scope is, I believe, a class wide scope, and the only way to limit
the scope to a single method is to use the var keyword (or arguments scope)

-----Original Message-----
From: Chris Stoner [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 01, 2005 2:04 PM
To: CF-Talk
Subject: Re: Converting ASP class to CFC

There is no reason you cannot do it exactly this way:

<cfscript>
    myTabControl = createObject("component","path.to.TabControl");
        myTabControl.TabType = "TabTypeDynamic";
        myTabControl.TabSelected = "DefaultTab";
        myTabControl.ControlImagePath = "../tabcontrol/";
        myTabControl.ControlScriptPath = "../tabcontrol/";
</cfscript>

However, two things you might want to do (best practice):
1.  Move the set up to an init method like you suggested (make sure you
return the this scope in the init)

<cfset myTabControl =
createObject("component","path.to.TabControl").init("TabTypeDynamic","Defaul
tTab","../tabcontrol/","../tabcontrol/")
/>

2.  Make the data properties private (use variables scope rather then this
scope inside cfc) and uses accessor methods to change them.

<cfset type = myTabControl.getTabType() />
<cfset myTabControl.getTabType("TabTypeDynamic") />


On 12/1/05, Robert Everland III <[EMAIL PROTECTED]> wrote:
>
> I have a couple questions about doing this.
>
> How would I emulate this behavior?
>
> Set MyTabControl = New TabControl
> MyTabControl.TabType = TabTypeDynamic
> MyTabControl.TabSelected = DefaultTab
> MyTabControl.ControlImagePath = "../tabcontrol/"
> MyTabControl.ControlScriptPath = "../tabcontrol/"
>
> I am thinking I would need to have an init() function because I don't
> think a cfc can be created like that. I have this. variables in my cfc so
> should I be able to do MyTabControl.whatever as long as there is a this in
> the cfcomponent?
>
>
>
>
> Bob
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:225855
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to