DataGrid / Context menu - HowTo

C

coltrane

Can someone direct me to a reference that describes how to create a
context menu for a selected row in a datagrid? I have come across many
threads regarding context menus and datagrids but they all seem to be
how to modify the default behavior. I've gone through a couple of books
and many threads but none of these seem to discuss creating a context
menu for a given row. I did come across a thread that allowed me to
create a menu for the entire grid but that even allows for a context
menu outside of any rows.


thanks for your help


john
 
O

Otis Mukinfus

Can someone direct me to a reference that describes how to create a
context menu for a selected row in a datagrid? I have come across many
threads regarding context menus and datagrids but they all seem to be
how to modify the default behavior. I've gone through a couple of books
and many threads but none of these seem to discuss creating a context
menu for a given row. I did come across a thread that allowed me to
create a menu for the entire grid but that even allows for a context
menu outside of any rows.


thanks for your help


john

You might try capturing the row number from the right click and display your
context menu based on something you determine from the row's data or which
column the right click targeted.

Pseudo code:

If the right click is in Column 1
row display a context menu that is appropriate for column 1
else display a context menu that is appropriate for column[n]
.....


Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
 
C

coltrane

thanks for the help. Worked like a charm.


Otis said:
Can someone direct me to a reference that describes how to create a
context menu for a selected row in a datagrid? I have come across many
threads regarding context menus and datagrids but they all seem to be
how to modify the default behavior. I've gone through a couple of books
and many threads but none of these seem to discuss creating a context
menu for a given row. I did come across a thread that allowed me to
create a menu for the entire grid but that even allows for a context
menu outside of any rows.


thanks for your help


john

You might try capturing the row number from the right click and display your
context menu based on something you determine from the row's data or which
column the right click targeted.

Pseudo code:

If the right click is in Column 1
row display a context menu that is appropriate for column 1
else display a context menu that is appropriate for column[n]
....


Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
 
O

Otis Mukinfus

thanks for the help. Worked like a charm.

You're welcome sir. Glad it worked for you.
Otis said:
Can someone direct me to a reference that describes how to create a
context menu for a selected row in a datagrid? I have come across many
threads regarding context menus and datagrids but they all seem to be
how to modify the default behavior. I've gone through a couple of books
and many threads but none of these seem to discuss creating a context
menu for a given row. I did come across a thread that allowed me to
create a menu for the entire grid but that even allows for a context
menu outside of any rows.


thanks for your help


john

You might try capturing the row number from the right click and display your
context menu based on something you determine from the row's data or which
column the right click targeted.

Pseudo code:

If the right click is in Column 1
row display a context menu that is appropriate for column 1
else display a context menu that is appropriate for column[n]
....


Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
 

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