Activate dojo dgrid editor using keyboard - dojo

Triggering edit mode in dojo dgrid with mouse event is easy. Here's what I have done:
editor({field: "checkNumber",label: "Check Number",editOn: "click"})
However, i want to trigger edit mode using keyboard. Specifically, i want to go into edit mode when I press the space key. How can I programmatically set a cell to 'edit mode' or 'non-edit mode'?

When you add one or more editor columns to a grid, it makes the edit method available on the grid instance, which you can call with a cell element (or event referencing one) to programmatically shift focus to the editor for the cell.
Meanwhile, the Keyboard mixin has an addKeyHandler method which you can use to add handlers to respond to keydown events for particular keys.
Combining these two things, you can easily do the following to cause the grid to edit the focused cell when space is pressed:
grid.addKeyHandler(32, function (event) {
grid.edit(event);
});
(edit should have no effect for cells in non-editor columns.)
An alternative solution could be to create an extension event which triggers either on mouse click or on space keypress, and pass that to editOn instead of 'click'.

var grdobj = dijit.byId("...");
var editCell=grdobj.cell(rowNo, "checkNumber");
grdobj.edit(editCell);
Instead of cell function, you could make use of right, left, up, or down functions.
Hope that helps.

Related

In IntelliJ IDEA, how do I use the keyboard to highlight an arbitrary checkbox?

For example, if I press Ctrl-Alt-P to extract a parameter, pressing Tab on the resulting dialog box moves directly from "Name" to "Refactor". I know I can work around this by using Alt+key to select a checkbox (e.g., Alt+a for replace all), but as AltGr doesn't work I have to contort my left hand to hit this combination. How do I, using the keyboard, select the first checkbox, so I can use space to change it?
The only way to access the checkboxes in this dialog is via mnemonics (Alt+underlined letter).
There is also an open issue to add tabstops for checkboxes and radio buttons in the refactoring dialogs so that they can be accessed not only by the mnemonics, but also by cycling the components using Tab:
IDEA-154127 Extract refactorings: navigation and mnemonics problems
There is really nothing you can do about it until tabstops are explicitly implemented for these dialogs.

How can I remove windows right click menu?

I have a group of text boxes within my form. Whenever I right click on them or the panel they are in, I get this menu:
I want to remove this menu from showing, and leave the right click to be nothing. However, the mouseclick event never fires for any of these. Therefore, I am having trouble getting rid of it. It usually shows up when my text is highlighted.
Is there a way to remove it? Or am I looking in the wrong event?
Another option is to set the ShortcutsEnabled Property of the TextBoxes to False:
Use the ShortcutsEnabled property to enable or disable the
following shortcut key combinations and the control’s shortcut
menu
This disables the keyboard shortcuts as well; not sure if that is applicable to your scenario.

Using Enter key to invoke different methods in Mac(objective c)

I am new to Objective c programming. I have created an application which has a UI with two buttons "Cancel" and "Ok". On clicking "Cancel", the application must terminate and clicking "Ok" must perform some task. Everything works fine. I am able to tab between these buttons and can call the required functionality by clicking space button.
All I want to do is, that when focus is on "Cancel" button(using tab key) then on clicking enter button from keyboard, my application should terminate and similarly, when focus is on "Ok" button then clicking enter should perform the desired functionality.
I have even set the 'setKeyEquivalent" property of the "Ok" and "Cancel" button, but I can only set unique keyequivalents. I also tried to read the title or tag value of the buttons and then call the required functionality but it didn't worked too.
Can someone please guide me how can I use enter button to invoke different functions depending upon the selected button in UI.
I think you don't want to set key equivalents for the buttons. You would want to override keyDown: and test for the enter key, then do the appropriate thing depending on which button had focus (which I think you could determine using NSWindow's firstResponder method).

DevExpress VerticalGrid Validate event and behavior with RadioButton cell editors

I'm using the VerticalGrid in MultiRecordView. Its Validate event fires when the grid detects that a record that has been changed is losing focus. I'm writing data to the database from this event.
My users want to use the keyboard left/right arrow keys to move forwards and backwards through the recordset, so I trap those keys and set the FocusedRecord accordingly.
If one of the row editors is a RepositoryItemRadioButton, the Validate event doesn't always fire. The users will click on the radio-button value desired and then, before they click on another row in the record, they'll hit the arrow key to move to the next record. The change to the radio button group has not been detected by the grid in that sequence of events.
The radio button change is detected only when the button loses focus.
Is there a way to cause the vertical grid to recognize that a radio button editor has been changed and fire the Validate event, if the user doesn't give another row in the record the focus?
I thought EditValueChangedFiringMode property controlled that behavior, but setting it to Default or to Buffered does not have the desired effect.
Thanks

VB.NET-Grid double click fires on single click

Ok, here is a weird VB.NET Grid problem. I am sure it is really simple, but it doesn't make sense to me.
I have a grid that displays data from a binding source. I have a method to handle the CellContentDoubleClick which will get the value of the cell and use that to do a new look up. This will generate a new datasource (with different columns) which I then rebind to the grid.
My grid double click works, but when it repaints with the new data, a single click fires the double click. This happens whether or not thre is a single click handler.
The interesting thing is that it is (in my case) a toggle. If I double click, on the repaint, a single click fires the double click code. When it repaints again, I need a double click.
The double click code fires off a messagebox - if I tell it not to continue, then I have to double click to get it to fire again. So it is not dependant on what data is displayed.
When it is in the mode to respond to a single click, I can tab through all the controls and then click on any cell in the grid and it will still fire the double click.
No matter what I try to do (set focus to other controls, refresh the grid, etc.) nothing seems to reset the grid so it works consistently.
Any ideas?
Ok, I found the answer. The data grid (at least in VS.Net 2007) has a property named "EditMode". If that is set to EditOnEnter (NOT the default) then you will experience this behavior. If you reset it (or change it to EditOnKeystrokeOrF2) then the datagrid will work as you expect (no single clicks acting like double clicks.)
This is after testing with threads, subclassed grids, you name it... I should have reviewed the property settings first.... grumble....