I have a ultrawingrid bound to ultradatasource (version 2020.1)
The grid is multiband (depth 2). In band1 users can go into edit mode pressing digit or letter key. Edit Mode is startet in KeyPress-Event if pressed key is digit or letter.
Problem: If user press DEL-Key, the cell text of the active cell gets deleted. How I can trap the DEL-Key? If cell-text is deleted I should do some depending action in related data.
I have tried KeyDown, KeyPress, BeforeCellUpdate, AfterCellUpdate but none of these events gets raised.
Grid InitializeLayout:
e.Layout.Override.AllowAddNew = AllowAddNew.No; e.Layout.Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.False; e.Layout.Override.AllowDelete = Infragistics.Win.DefaultableBoolean.False;
e.Layout.Override.SelectTypeCol = SelectType.None; e.Layout.Override.SelectTypeRow = SelectType.None; e.Layout.Override.SelectTypeCell = SelectType.None;
e.Layout.Override.CellClickAction = CellClickAction.CellSelect; e.Layout.Override.HeaderClickAction = HeaderClickAction.Select;
Band 1
band1.Override.CellMultiLine = DefaultableBoolean.True;
band1.Override.SelectTypeCell = SelectType.Extended;
any ideas how to capture the DEL-Key?
Thats it Mike!
I have found a toolbar manager tool defined shortcut. Pressing the DEL-Key the ToolbarsManager_Toolclick event is called.
Thank you.
Markus
The Del key (and other non-visible keys) are not raise the KeyPress event. But they do raise KeyDown and KeyUp events.
If these events are not firing on your grid, then something else is trapping and handling those keys before they get to the grid. The most common culprit in that scenario is a toolbar.
If you have a ToolStrip or an UltraToolbarsManager and you have a Del menu option that uses the Del key as a shortcut, then that toolbar menu item will get first crack at the Del key and it will handle it in the Toolclick event and it will not fire KeyDown or KeyUp on the active control since the key was handled.
Hello Bozhidara
Thank you for your answer.
In your sample project you set CellCliclAction to EditAndSelectText. I did not have this (see my last post). If users click a cell, the cell just get selected. But anyway, if I change your sample to this, it is still working - but not in my grid.
Therefore I looking for some settings in my grid that can influence the behaviour of the DEL-Key KeyPress-Event.
My grid is representing a activity plan for employees on day basis. Columns are calendar days, Rows are organisations while Band0 are departments, Band1 employees, Band2 day-notes. The cell we are talking about is on band1. The cell shows a activity-code and if users press DEL-Key I have have to capture this to execute some business rules, delete the activityplan at the date etc. EditMode ist started in KeyPress-Event if users press DigitOrLetter-Key. Validation of valid activity-code ist checked in BeforeExitEditMode and AfterExitEditMode executes the business rules (also if all text is deleted in edit mode).
The grid setup has 3 fixed columns left. On employee rows (band1) cell appearance and cell activation can be setup on some cells depending on activity states, locked cells are setup if no employment, etc.
I have tried to comment out most of the layout code - but still no KeyPress-Event.
Do you have any ideas which settings can influence the DEL-Key?
Thank you for any help.