context menu for undo/redo buttons

  • Thread starter Thread starter Dennis C. Drumm
  • Start date 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
 
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
 
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."
 
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
 
Kevin:

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

thanks,

Dennis
 
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."
 
Kevin,

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

Dennis
 
Back
Top