From: Larry Serflaten on

"Webbiz" <nospam(a)forme.thanks.com> wrote


> What I described at the beginning of this message is basically what
> I'd like to do. How to do it is another thing. As you said, the
> objects exist separately. So then, this moves me to my question as to
> whether objects from the same class can be made to KNOW what each are
> doing as well as to REACT to them in some way (to make the auto sizing
> work, for example)?

Thats going to get a bit tricky. The problems I see with that method is
that you need some sort of master/slave setup so that the indicators
can get their data from the master chart, and not have to keep a copy of the
data array themselves. Otherwise, a chart with 4 indicators would mean
5 copies of the data array, one in each control.

If you moved that data array to a class that only deals with the data, you could
give that class methods like:

ReadFromFile
SaveToFile
MoveToFirst
MoveToLast
MoveNext
MovePrev
MoveToDay
SortBy

Plus all the Get/Let properties for the UDT members.

Done that way, you would never have to expose the UDT array, and not have
to fuss with its private or public availablilty. The class would encapsulate all
that and would be easy to let several other objects access the same array by
passing references to the class.

Just another thought for the idea pool....
LFS






From: Webbiz on
On Sun, 6 Sep 2009 19:04:01 -0500, "Larry Serflaten"
<serflaten(a)usinternet.com> wrote:

>
>"Webbiz" <nospam(a)forme.thanks.com> wrote
>
>
>> What I described at the beginning of this message is basically what
>> I'd like to do. How to do it is another thing. As you said, the
>> objects exist separately. So then, this moves me to my question as to
>> whether objects from the same class can be made to KNOW what each are
>> doing as well as to REACT to them in some way (to make the auto sizing
>> work, for example)?
>
>Thats going to get a bit tricky. The problems I see with that method is
>that you need some sort of master/slave setup so that the indicators
>can get their data from the master chart, and not have to keep a copy of the
>data array themselves. Otherwise, a chart with 4 indicators would mean
>5 copies of the data array, one in each control.

I thought that this data array was passed by ref only. If that be the
cause, there really would not be 5 copies, right? You'd simply have 5
controls referening 1 data array. Or what am I missing here?

In case knowing this is important, the dataarray is read-only. Once
loaded into the program (array), it is used to draw charts or
calculate indicators, etc.

>If you moved that data array to a class that only deals with the data, you could
>give that class methods like:
>
>ReadFromFile
>SaveToFile
>MoveToFirst
>MoveToLast
>MoveNext
>MovePrev
>MoveToDay
>SortBy
>
>Plus all the Get/Let properties for the UDT members.
>
>Done that way, you would never have to expose the UDT array, and not have
>to fuss with its private or public availablilty. The class would encapsulate all
>that and would be easy to let several other objects access the same array by
>passing references to the class.
>
>Just another thought for the idea pool....
>LFS

Okay. Food for thought. So you're saying that instead of using a UDT
data array defined in a module or form, to create a class that will
hold the data itself. So when data is loaded into the program, it is
loaded into the data object. When you want to retrieve it, you get it
from the data object. The data object becomes my data array.

If that's what you're saying, that sounds like a pretty cool idea.

However, if what I said above is correct about passing by ref, all
that is achieved is that the data is encapsulated and UDT hidden. I
don't know if the UDT needs to be hidden though. But if it gets away
from having to mess with private/public/friend etc., that be nice.

Assuming the data array class, how would you give the other objects
access? How's the reference passed?

:-)

Webbiz
From: Ralph on
Webbiz wrote:
>
>
> I've got several VB6 books. They don't cover the same things. Do you
> know a great source of information for beginners that has a lot of
> focus on the above you discuss? A recommended book perhaps that is as
> easy to follow as VB6 for Dummies or VB6 in Plain English (easiest
> reads that don't make your eyes go cross)?
>

The Book: "MCSD in a Nutshell", James Foxall, O'Reilly

[Out of print, thus very cheap. I have also run across occasional links
where this book or various chapters are published online.]

This includes all the fundamentals. From there just grab every source-code
example you can get your hands on. Don't worry if the control appears to not
contain the functionality you are looking for, as many of the most mundane
examples often carry nuggets of ideas and information.

"Good artists copy. Great artist steal", Pablo Picasso

-ralph


From: Ralph on
Ralph wrote:
>
> The Book: "MCSD in a Nutshell", James Foxall, O'Reilly
>

The complete title is: "MCSD in a Nutshell: The Visual Basic Exams"


From: Webbiz on
On Sun, 06 Sep 2009 20:19:52 -0300, Eduardo <mm(a)mm.com> wrote:

Yo escribi� inline as well. :-)


<snip>

>>
>> 5. For basic functionality, it needs to be PASSED an array of type
>> DATA_ARRAY (user defined type).
>
>Use a class and a collection instead.
>Or use one base Class and another Class containing the array of classes
>of the first type (in a property).

I'm not sure I understand the suggestion above. But I think I'm going
to forego the UDT DATA_ARRAY in module and use Larry's suggestion of a
DATA CLASS that's sole purpose is to hold the data for retrieval. Is
this anything close to what you are talking about above?

>>
>> 6. If possible, since each instance of this User Control will use the
>> SAME arrDataArray() as DATA_ARRAY, it would be cool if this could be
>> passed once, to the first object created, and then each new object
>> created already has this connection. Possible?
>
>Yes, put a public variable in a standard module to hold a reference to it.

This is what I want to avoid. It makes the objects dependant on a
outside variable. I was hoping his could have been inherited. I
believe I read that VB6 cannot do real inheritance (bummer).

Thanks Eduardo.

:-)