Selection of multiple controls on a panel

G

Guest

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.
 
G

Guest

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
 
G

Guest

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
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top