By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,023 Members | 1,235 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,023 IT Pros & Developers. It's quick & easy.

Selection of multiple controls on a panel

P: n/a
Hi there,

In my application I have a panel that contains a matrix of user controls.
The user control is fairly simple. It merely draws a circle that represents
an object in my code. The object has certain properties that can be
configured, so each control has a context menu that allows such operations.

However, my application requires setting properties for multiple objects at
once. That would require being able to select multiple controls, and having a
context menu for the selection of controls. You could compare it to selecting
icons of the Windows desktop and right-clicking to do something or configure
something, like deleting or setting properties.

My question is how I would go about doing that?

With kind regards,
Tom Tempelaere.
Nov 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi Tom,

I think you need to create an container control by your own, capable of
enumerate the contents, this will allow you to call the "general" context
menu and then execute the order per object.

The listview is an example, but of course it implents this tecnique with its
own custom code.

It seems complex but if you think about a little while you can figure the
solution in 1 day,

Some tips:
1) Trap the event when you drag the mouse, from x,y to your final x,y, so
you get a rectangle
2) Your container should store a matrix with the objects positions.
3) Then you can intersect those points with the rectangle and check which
ones are inside
4) Store those objects references in an array
5) Apply the context menu function to those objects on the array.

I don't know if there is a custom control (or even commercial) around to buy
this feature, but I usually go for the custom ones.

Hope this helps
Salva

"TT (Tom Tempelaere)" wrote:
Hi there,

In my application I have a panel that contains a matrix of user controls.
The user control is fairly simple. It merely draws a circle that represents
an object in my code. The object has certain properties that can be
configured, so each control has a context menu that allows such operations.

However, my application requires setting properties for multiple objects at
once. That would require being able to select multiple controls, and having a
context menu for the selection of controls. You could compare it to selecting
icons of the Windows desktop and right-clicking to do something or configure
something, like deleting or setting properties.

My question is how I would go about doing that?

With kind regards,
Tom Tempelaere.

Nov 17 '05 #2

P: n/a
Hi Tom,

I think you need to create an container control by your own, capable of
enumerate the contents, this will allow you to call the "general" context
menu and then execute the order per object.

The listview is an example, but of course it implents this tecnique with its
own custom code.

It seems complex but if you think about a little while you can figure the
solution in 1 day,

Some tips:
1) Trap the event when you drag the mouse, from x,y to your final x,y, so
you get a rectangle
2) Your container should store a matrix with the objects positions.
3) Then you can intersect those points with the rectangle and check which
ones are inside
4) Store those objects references in an array
5) Apply the context menu function to those objects on the array.

I don't know if there is a custom control (or even commercial) around to buy
this feature, but I usually go for the custom ones.

Hope this helps
Salva

"TT (Tom Tempelaere)" wrote:
Hi there,

In my application I have a panel that contains a matrix of user controls.
The user control is fairly simple. It merely draws a circle that represents
an object in my code. The object has certain properties that can be
configured, so each control has a context menu that allows such operations.

However, my application requires setting properties for multiple objects at
once. That would require being able to select multiple controls, and having a
context menu for the selection of controls. You could compare it to selecting
icons of the Windows desktop and right-clicking to do something or configure
something, like deleting or setting properties.

My question is how I would go about doing that?

With kind regards,
Tom Tempelaere.

Nov 17 '05 #3

P: n/a
Hi Salvador,

I was hoping to find an example or a link that explains how to do this. I
haven't found one yet, hence the question. I'd rather start from an example
but any hint is good.

I will have to think about this a little longer. Problem is that I don't
have a lot of time to code this, and obviously, selecting the controls is not
really the focus of the project.

Thanks for the suggestion, and kind regards,
Tom Tempelaere.

"Salvador" wrote:
Hi Tom,

I think you need to create an container control by your own, capable of
enumerate the contents, this will allow you to call the "general" context
menu and then execute the order per object.

The listview is an example, but of course it implents this tecnique with its
own custom code.

It seems complex but if you think about a little while you can figure the
solution in 1 day,

Some tips:
1) Trap the event when you drag the mouse, from x,y to your final x,y, so
you get a rectangle
2) Your container should store a matrix with the objects positions.
3) Then you can intersect those points with the rectangle and check which
ones are inside
4) Store those objects references in an array
5) Apply the context menu function to those objects on the array.

I don't know if there is a custom control (or even commercial) around to buy
this feature, but I usually go for the custom ones.

Hope this helps
Salva

"TT (Tom Tempelaere)" wrote:
Hi there,

In my application I have a panel that contains a matrix of user controls.
The user control is fairly simple. It merely draws a circle that represents
an object in my code. The object has certain properties that can be
configured, so each control has a context menu that allows such operations.

However, my application requires setting properties for multiple objects at
once. That would require being able to select multiple controls, and having a
context menu for the selection of controls. You could compare it to selecting
icons of the Windows desktop and right-clicking to do something or configure
something, like deleting or setting properties.

My question is how I would go about doing that?

With kind regards,
Tom Tempelaere.

Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.