Feb 02, 2010, 9:36 AM
RE: [CLOSED] Keymap in Desktop Window
Hi Amit,
1. If you need to intercept Enter key on a TextField then use SpecialKey event
[quote]specialkey : ( Ext.form.Field this, Ext.EventObject e ) Fires when any key related to navigation (arrows, tab, enter, esc, etc.) is pressed. To handle other keys see Ext.Panel.keys or Ext.KeyMap. You can check Ext.EventObject.getKey to determine which key was pressed.[/CODE]
For example:
[CODE]var form = new Ext.form.FormPanel({
...
items: [{
fieldLabel: 'Field 1',
name: 'field1',
allowBlank: false
},{
fieldLabel: 'Field 2',
name: 'field2',
listeners: {
specialkey: function(field, e){
// e.HOME, e.END, e.PAGE_UP, e.PAGE_DOWN,
// e.TAB, e.ESC, arrow keys: e.LEFT, e.RIGHT, e.UP, e.DOWN
if (e.getKey() == e.ENTER) {
var form = field.ownerCt.getForm();
form.submit();
}
}
}
}
],
...
});
Listeners will be called with the following arguments:
- id of your tree is 'ca_calendarTree' but in the Click handler of the 'ca_btnSharing' button you use 'calendarTree'
- unfortunately you did not send code-behind. Do you call SelectNode during initial Page_Load? I found the following script at the end of generated section
1. If you need to intercept Enter key on a TextField then use SpecialKey event
[quote]specialkey : ( Ext.form.Field this, Ext.EventObject e ) Fires when any key related to navigation (arrows, tab, enter, esc, etc.) is pressed. To handle other keys see Ext.Panel.keys or Ext.KeyMap. You can check Ext.EventObject.getKey to determine which key was pressed.[/CODE]
For example:
[CODE]var form = new Ext.form.FormPanel({
...
items: [{
fieldLabel: 'Field 1',
name: 'field1',
allowBlank: false
},{
fieldLabel: 'Field 2',
name: 'field2',
listeners: {
specialkey: function(field, e){
// e.HOME, e.END, e.PAGE_UP, e.PAGE_DOWN,
// e.TAB, e.ESC, arrow keys: e.LEFT, e.RIGHT, e.UP, e.DOWN
if (e.getKey() == e.ENTER) {
var form = field.ownerCt.getForm();
form.submit();
}
}
}
}
],
...
});
Listeners will be called with the following arguments:
this : Ext.form.Field
e : Ext.EventObject, The event object
2. About TreePanel- id of your tree is 'ca_calendarTree' but in the Click handler of the 'ca_btnSharing' button you use 'calendarTree'
- unfortunately you did not send code-behind. Do you call SelectNode during initial Page_Load? I found the following script at the end of generated section
ca_calendarTree.getNodeById("17").select();
Please note that you cannot select node immediately because nodes are rendered after tree rendering. Therefore you can use AfterRender eventnode = exampleTree.getNodeById(id);
node.ensureVisible(function () {
exampleTree.getNodeById(this.id).select();
}, node);
Also if you use tree with drop down field then you can use ValueText mode with SyncValue method. See the following sample Ext.Net.Examples\Examples\Form\DropDownField\Value Text_Mode\