Re: Variable for a Variable
- From: "ProfitMaxTrading.com" <nospam@xxxxxxxxxx>
- Date: Thu, 27 Oct 2005 23:27:18 -0500
Hello Frank.
I certainly can see the advantage to your suggestion. The reason I
originally went the other way (wrong way - duh beginner here) is that each
tool had has completely different elements that describe them.
For example:
The Trendline tool requires:
Cordinates x1, x2, y1, y2.
Record Number (to ID price bar)
Time Frame (Daily, Weekly or Monthly)
Visible (for delete purposes)
Color
....
Then say the FibLines tool requires:
Record Number A (for starting price bar - x axis coordinates)
PriceA (for starting price bar high/low price - y axis coordinates)
Record Number B (for ending price bar)
Price B
Time Frame (D,W,M)
Visible
Color
Type (Retracement/Expansion/Alt-Expansion)
Can you see what I mean? Each tool has their own UNIQUE requirements to
locate, identify, create, etc.
Now I could create a TOOL_STRUC that simply contained every possible tool
variable I'll need. But would that be a better way to go than rather having
these unique STRUCS due to the tools being so diverse?
Yes, they do all have some items in common.
Color
Visible
Time Frame
What do you think?
THANKS A BUNCH. :-)
"Frank Adam" <fajp@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:nm63m15h58f3mktl7vetlp8bf3dvuh56pk@xxxxxxxxxx
> On Thu, 27 Oct 2005 20:48:15 -0500, "ProfitMaxTrading.com"
> <nospam@xxxxxxxxxx> wrote:
>
>>And therefore be able to do this:
>>
>> sArrayName = ToolName(Tool_ID)
>> sArrayName(iElements).Visible = False
>>
>>??
>>
>>Is this possible? Or is the language limited in this respect?
>>
> If i understand what you mean, you are going about this the wrong way.
> Code speaks volumes, so..
>
> use constants for the IDs
>
> private const T_SAW = 0
> private const T_DRILL = 1
> etc..
>
> Private Type TOOLS_T
> tID as long
> visible as boolean
> tNames() as string
> End type
>
> dim tools(30) as TOOLS_T
>
> ' Us this function to add each tool.
> 'remember the ID corresponds to the index of the tools in this sample.
> ' So tools(0) = Saw, tools(1) = drill
> 'If later it has to become dynamic, so you can add tools, that's no
> ' big problem, it would just need a bit of rewrite on the dims and a
> ' simple lookup function added.
> Private Sub AddTool(s as string, id as long)
> dim i as long 'index into tName array
> with tools(id)
> on error resume next
> i = ubound(.tNames)
> if err.number = 0 then 'it's been dimmed once
> i = i + 1 'so add one.
> end if
> on error goto 0
> redim preserve .tNames(i)
> .tNames(i) = s
> end with
> end sub
>
> Sub SelectTool(id as long)
> tools(id).visible = true
> end sub
>
> Private sub Form_Load()
> call AddTool("Bosch",T_DRILL)
> call Addtool("Makita",T_DRILL)
> call AddTool("Stanley",T_SAW)
> call SelectTool(T_DRILL)
> debug.print tools(T_DRILL).tNames(0), tools(T_DRILL).visible
> debug.print tools(T_DRILL).tNames(1), tools(T_DRILL).visible
> debug.print tools(T_SAW).tNames(0), tools(T_SAW).visible
> End sub
>
> See if you can build around that idea better ?
>
> --
>
> Regards, Frank
.
- Follow-Ups:
- Re: Variable for a Variable
- From: Dag Sunde
- Re: Variable for a Variable
- References:
- Re: Variable for a Variable
- From: Frank Adam
- Re: Variable for a Variable
- Prev by Date: Re: Variable for a Variable
- Next by Date: Re: How to clone a form object?
- Previous by thread: Re: Variable for a Variable
- Next by thread: Re: Variable for a Variable
- Index(es):
Relevant Pages
|