context menu for undo/redo buttons

  • Thread starter Dennis C. Drumm
  • Start date
D

Dennis C. Drumm

How do I program the context menu of an undo/redo toolbar button drop down
menu to behave like the vs.net undo where all previous menu items are
selected as the user moves the mouse pointer down the list?

Thanks,

Dennis
 
D

Dennis C. Drumm

Never mind, I figured it out.

Although I still do wonder how to get the item at the bottom of the dropdown
list that keeps track of how many items are selected.

Dennis
 
K

Kevin Yu [MSFT]

Hi Dennis,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know how to get the last
item selected on a combo box to get the count of items selected. If there
is any misunderstanding, please feel free to let me know.

I think we can use ComboBox.SelectedIndex to get the current selected item.
Since the items before the selected one are all selected, the count equals
to SelectedIndex +1.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
D

Dennis C. Drumm

Kevin

I wanted to make sure that the all items in the list wouold be automatically
slected as they are in the undo dropdown button in vs.net. I believe that
can probably be done with the MenuItem.Select event.

The other issue was how to get the text at the bottom of the dropdown that
shows the count. I know how to get the count, what is a mistry is how to get
the centered text at the bottom of the dropdown.

Thanks,

Dennis
 
D

Dennis C. Drumm

Kevin:

How do I use a ComboBox in place of a ContextMenu for the undo toolbar
button?

thanks,

Dennis
 
K

Kevin Yu [MSFT]

Hi Dennis,

Could you let me know how you implement the undo button? Are you using a
context menu or a combo box?

As far as I know, a ComboBox does not support multiple selection. It means
that we cannot make all the above items selected when the bottom on is
clicked. We can only get the item selected using ComboBox.SelectedItem. If
you need to get the text directly, use ComboBox.SelectedText.

To get the text of the bottom item, use the following:
this.comboBox1.Items[this.comboBox1.Items.Count-1].ToString();

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
D

Dennis C. Drumm

Kevin,

Thanks for the comments. It turns out, I need to impliment a user control to
get the functionality I am looking for.

Dennis
 

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

Similar Threads

Undo/Redo 4
Default Context Menu for DataGridView 1
custom paste context menu fvor text boxes 9
Undo option in Edit Menu 1
ListView vs ListBox 2
List View Context Menu 2
Undo and redo in word 1
undo/redo buttons 1

Top