From: Ralph on
Ralph wrote:
>
> Note: What mayayana refers to as a 'bug' is defined behavior. Any OLE
> control actually has two lives. One is its design-time or 'InPlace'
> behavior, and when the control is running within an application.

Oops!

The term 'InPlace' is a bad use. I was thinking of various states of
'Activation', but best to just ignore it and not go there. <grin>

-ralph


From: Ralph on
Ralph wrote:
> .... You can not test or "use"
> the control you are building until you shut-down the UserControl
> module. (close the file) After you do that - THEN you can plop your
> created control on a Form and test and abuse *its* design-time.
>

Oops again. Should have said: " ... and test and abuse *its* design-time and
run-time."

-ralph


From: Bee on
2 cents from an old guy.
Only use a user control if you have to, i.e. need the same functionality in
multiple place in the same project. The learning curve is high and there are
got-yahs.

Do not use an .ocx . You are asking for pain.

I have done all of the above and now only use a user control within the
project and only if I really need multiples of the same control.

Otherwise it is just not worth the pain.
My current project has one user control that I use four places so it works
OK for this.
But I wrote the usercontrol to reconfigure itself since each instance of the
user control is visually a little different. e.g. record button not needed
for a playback only situation.
It does keep the code maintenance a little lower once you have it all
together.
I added another button, loop, and that was not too hard because all the
supporting code was there and I could copy, paste and modify most places to
add the new button.


"Webbiz" wrote:

> This is sort of a branch off of my original quest to create a
> contained (drop-in) solution to creating objects for drawing charts
> and indicator panels.
>
> Searching through the books and internet on the subject of User
> Controls in VB6, what I've learned is this is what is called Active X
> controls. I believe it is one and the same. Correct me if I'm wrong.
>
> While testing out the Wizard for creating a User Control, I am
> presented with the task of knowing right there and then what methods
> and properties I will need. This stopped me in my tracks.
>
> You see, when I was starting to work on the CLASS (cCanvas) itself, I
> didn't know what methods or properties I would need until I came to a
> problem that needed solving. Only then did I figure I needed this
> Property, and this Method, etc. In short, it evolved as I went along.
>
> Sitting there staring at a window (in the Wizard) asking me to tell it
> right there and then what Methods or Properties to include was simply
> overwhelming.
>
> So why this post?
>
> Because I'd like to know from the User Control pros here whether they
> started out first creating a Class Module, tweaking it here and there,
> BEFORE finally deciding it was ready for prime time and to turn it
> into a User Control. Or what process usually precedes the User Control
> Wizard step?
>
> Thanks.
>
> Webbiz
>
>
>
From: Webbiz on
Thanks to all who responded to this thread.

I figured I'd respond in a single post. Yep, this one.

There was mention of creating an ActiveX IF you wanted to reuse for
other applications or the web. I'm puzzled by this. If the purpose is
not to reuse, why bother with User Controls to begin with, with the
exception of wanting to improve or change the functionality of an
existing control?

I've got a task in mind for this User Control experiment.

Before, I was using PictureBoxes. But someone suggested that with a
User Control there is no need. So I'm proceding on that basis.

Details:

1. To be able to reuse this for more than one program.

2. To easily drop this into a new project and start using it right
away.

3. Rather than being a visible control on the form, it simply provides
me with the ability to create instances (objects) from it that are
each independant of the other, YET are aware of the other in order to
share form space.

5. For basic functionality, it needs to be PASSED an array of type
DATA_ARRAY (user defined type).

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?


The snags I'm dealing with (the holes in my knowledge) is how to make
one object instance know that there are others and how much space it
is taking up. Also, how to adjust the others to make room for the new
one. Each of these objects will take up some form space for the
purpose of drawing lines, waves, etc.

Example: Say I create a User Control called Canvas.

I plop this baby on my form so that it becomes part of my new project.

I then create a new object from this control (I'm assuming you can do
this).

When I create the object, it notes that it's the only instance of the
UC and takes up all the space of the form for drawing.

I then create another object from this control. It also checks and
finds there is one other. So it calculates what space it wants on the
form and adjusts the drawing area of the first object. Then it claims
what's left.

Each time a new object is created, the same thing happens. Anytime one
of these objects is destroyed, the others reclaim the newly opened
space.

Please tell me I'm not on drugs thinking this is possible (we'll,
perhaps I am anyway. ;)


It just seems like a pretty cool thing to be able to just drop one of
these babies into a new project and as soon as you create an object
from it it is ready to display your line drawings. And you create
another object and it automatically shares form space. I'd think this
would simplify the creation of a charting program that the user can
add new indicator windows, delete them when no longer in use, and have
each contain their own type of indicator/drawing.

Well, I've babbled enough.

Thanks a bunch.

Webbiz










On Sat, 5 Sep 2009 16:45:55 -0500, "Ralph" <nt_consulting64(a)yahoo.com>
wrote:

>Ralph wrote:
>> .... You can not test or "use"
>> the control you are building until you shut-down the UserControl
>> module. (close the file) After you do that - THEN you can plop your
>> created control on a Form and test and abuse *its* design-time.
>>
>
>Oops again. Should have said: " ... and test and abuse *its* design-time and
>run-time."
>
>-ralph
>
From: Webbiz on
On Sat, 5 Sep 2009 18:21:01 -0700, Bee <Bee(a)discussions.microsoft.com>
wrote:

>2 cents from an old guy.
>Only use a user control if you have to, i.e. need the same functionality in
>multiple place in the same project. The learning curve is high and there are
>got-yahs.
>


Hello Bee.

Don't know if you read my long-winded "wish list" for this control.

But I think that is what I need it for.

Now I'm assuming we are not talking about plopping multiple controls
on the form. I just want the functionality to be 'duplicated' by
making new instances of the object or deleting them. They all will
need the same data array to do their job, and they all will need the
same routines to draw on their individual canvas area of the form.

Does this quality in your opinion?

Thanks.

Webbiz