Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
335
Main menu edit items and short cut keys questions
posted

hi all,

I have a Windows form with a main menu (UltraToolbarsManager).  This is a regular Windows main menu, not a ribbon.   On this menu I have standard edit menu items, i.e, Copy, Paste, Cut...     On the form, I have 3 grids, 1 tree, and some textboxes.   I want to use this set of edit menu items to control the edit functions of all controls on the form.     For example, I should be able to copy text from any text field, like a textbox or a grid cell by using the same Copy button from the main menu.      Also I should be able to do the same with Ctrl+C.     Also I should be able to copy and paste tree nodes.

What's the most efficient way to implement this?  

I've read this article: http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/WinGrid_Creating_an_Edit_Menu_with_Clipboard_Operations_for_WinGrid.html

but having several issues:

1. This sample uses the Edit menu items to control one grid. What if I have many controls on the form that I need to edit?

2. Me.ultraGrid1.PerformAction(UltraGridAction.DeleteCells)   doesn't work.

3. this.ultraGrid1.PerformAction(UltraGridAction.Cut)    only works after the cell loses focus

4. If you copy the text from a grid cell then paste it to a textbox outside of the grid, only the column name is pasted. If paste to Notepad, both column name and text are pasted.    The correct behavior is that only the text should be pasted.

5. If I add ShortCut CtrlC to the Copy menu item,   CtrlC no longers works on other controls outside of the grid.

please help. Basically I need something like the MS Word Edit menu items that work on all controls

thanks in advance.

Tony.

Parents
No Data
Reply
  • 469350
    Suggested Answer
    Offline posted

    Hi Tony,

    tony_easyrider said:
    2. Me.ultraGrid1.PerformAction(UltraGridAction.DeleteCells)   doesn't work.

    I tried this out and it works fine for me. In order for this to have any effect, there are a couple of confitions that must be met.

    First, the AllowMultiCellOperation property has to be set to all Deleting.

    Second, the grid must have some cells selected. Selecting a Row will not do it, nor will selecting a column. Also, there's a difference between selecting a cell and selecting text within that cell. The cell itself must be selected for this to work.

    tony_easyrider said:
    3. this.ultraGrid1.PerformAction(UltraGridAction.Cut)    only works after the cell loses focus

    I tested this out and it also works fine for me, but it is subject to essentially the same conditions as DeleteCells.

    When a Cell is in edit mode, you need to deal with the text of that cell, you can't cut, copy, paste, or delete using PerformAction. You will probably need to operate on the grid's ActiveCell using the SelText, SelLength, and SelStart properties of the cell.

    tony_easyrider said:
    4. If you copy the text from a grid cell then paste it to a textbox outside of the grid, only the column name is pasted. If paste to Notepad, both column name and text are pasted.    The correct behavior is that only the text should be pasted.

    My guess is that your TextBox doesn't support multiline text. Make sure Multiline is set to true on the TextBox.

Children
No Data