468,720 Members | 1,510 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,720 developers. It's quick & easy.

Limiting a controls parent.

I want to create a set of Activity Diagram controls for process control.

I need to create a base Diagram control that acts as a container for the
Activity controls ( StartPoint, EndPoint, Actvity, Decision, Message,...).

How do I implement it such that the only place I can drop an Activity
control is on a Activity Diagram?

I'm an experienced Delphi developer and I'm just getting started in C#.
There appears to be significant crossover between the two languages.
Aug 1 '08 #1
4 1348
On Aug 1, 9:46*am, "Andrew" <and...@yahoo.comwrote:
I want to create a set of Activity Diagram controls for process control.

I need to create a base Diagram control that acts as a container for the
Activity controls ( StartPoint, EndPoint, Actvity, Decision, Message,...)..

How do I implement it such that the only place I can drop an Activity
control is on a Activity Diagram?

I'm an experienced Delphi developer and I'm just getting started in C#.
There appears to be significant crossover between the two languages.
hi

I do not undersstand your question, are you asking how to design your
classes or your interface?
Aug 1 '08 #2
Please understand I'm just getting started in C# but have 10+ years of
experience in Delphi, so if I'm not clear it's mostlikely because I don't
have C# on my fingertips yet.

I'm quite sure I can design the underlying class structure for the
implementation I'm looking for. It's the details on how Visual Studio
creates components and assigns them to parent controls during the design
process.

What I'd do in Delphi is create the Diagram control first from a TPanel
control. I would then write the Activity controls from TComponents. In the
constructor for the Activity controls I would check and see if the partent
was a Diagram control. If it was not, I would display a message then have
the Activity control commit suiside.

I'm just not sure when the parent is assigned if C# and if the constructor
is the best place to check the parent class in C#.

This is all just for completeness. I want to design a set of controls I can
use over and over again and pass on to others in our group.

"Ignacio Machin ( .NET/ C# MVP )" <ig************@gmail.comwrote in
message
news:97**********************************@c58g2000 hsc.googlegroups.com...
On Aug 1, 9:46 am, "Andrew" <and...@yahoo.comwrote:
I want to create a set of Activity Diagram controls for process control.

I need to create a base Diagram control that acts as a container for the
Activity controls ( StartPoint, EndPoint, Actvity, Decision, Message,...).

How do I implement it such that the only place I can drop an Activity
control is on a Activity Diagram?

I'm an experienced Delphi developer and I'm just getting started in C#.
There appears to be significant crossover between the two languages.
hi

I do not undersstand your question, are you asking how to design your
classes or your interface?
Aug 1 '08 #3
On Fri, 01 Aug 2008 07:31:51 -0700, Andrew <an****@yahoo.comwrote:
[...]
What I'd do in Delphi is create the Diagram control first from a TPanel
control. I would then write the Activity controls from TComponents. In
the
constructor for the Activity controls I would check and see if the
partent
was a Diagram control. If it was not, I would display a message then
have
the Activity control commit suiside.

I'm just not sure when the parent is assigned if C# and if the
constructor
is the best place to check the parent class in C#.
I question the wisdom of designing the control so that it may only have
some specific type of control as its parent. IMHO, it's much better to
define some specific set of functionality that the parent is required to
have and check for that as needed.

That said, in .NET, the control's parent is not known during construction,
and in fact the parent can change over time (that is, some code could
specifically move the control).

The most appropriate place to check for some qualification of the
control's parent would be in the OnParentChanged() method. Override that,
and respond in whatever way is appropriate for your code if the new parent
isn't qualified. IMHO, all you really should do is throw an exception
(e.g. InvalidOperationException), but I suppose you could actually have
the control remove itself from the new parent and dispose itself (but
there's not really a good way for the control to inform its parent,
especially a parent that wasn't the right parent, to be aware of this...so
I'd really recommend against it).
This is all just for completeness. I want to design a set of controls I
can
use over and over again and pass on to others in our group.
Personally, I'd avoid trying to enforce a specific parent. But if you
really insist, hopefully the above would be helpful information.

Pete
Aug 1 '08 #4
AJ
I've a feeling that you _can_ do what you want to... the example code
I'm thinking of comes from
http://windowsclient.net/articles/shapedesigner.aspx
so have a look through that. But it was a while ago I tried this, so I
might be mis-remembering.
In article <48**********************@news.aliant.net>, an****@yahoo.com
says...
I want to create a set of Activity Diagram controls for process control.

I need to create a base Diagram control that acts as a container for the
Activity controls ( StartPoint, EndPoint, Actvity, Decision, Message,...).

How do I implement it such that the only place I can drop an Activity
control is on a Activity Diagram?

I'm an experienced Delphi developer and I'm just getting started in C#.
There appears to be significant crossover between the two languages.
Aug 1 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Brian Adams | last post: by
5 posts views Thread by Zürcher See | last post: by
reply views Thread by mawi | last post: by
5 posts views Thread by tshad | last post: by
1 post views Thread by CARIGAR | last post: by
1 post views Thread by Oskars | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.