Jump to content

Enter Like Tab


dionel1969

Recommended Posts

Hello !!!

 

I was looking for this theme here but I did not find anything about it. So, the question is: How to make that the ENTER Key works as TAB Key??? Normally, in windows, I do this in the form checking Key value of OnKeyDown parameter, in the FORM, so it could works for all Control that does not manipulate ENTER (except MEMO and others). Yesterday I was playing with this event in the form, but it never was called. I did it in one form, but in every control, this form has only 3 controls, but in other forms, with more controls is a tedious process, It est, I can share a common keydown event manager, but I have to set it to all form's controls.

The question: I have to do this in the Client Side??? if yes, How it will mix with the OnKeyDown events of control in the other side???

 

PS: It is a common problem because people who works with numbers in accounting departments, and others use a keypad all the time, so the ENTER key is better to navigate through the fields.

 

ENTER -> Move forward

SHIFT + ENTER -> Move backward

CTRL + ENTER -> Accept form in any field. (Like press in OK button with mouse)

Link to comment
Share on other sites

I have the same issue and use case is pretty much the same, accounting. Similar behaviour is requested for grid cells.

 

I actually asked about this quite a while back, but there didn't seem to be concensus on this being an important feature.

 

People here knows that this is a very important issue. Of course, there are other issues about bugs that know is taking the first place, but the framework is maturing very well and soon will be possible to review these details. You can see Fharshad's comments about.

 

In the case of grids it is necessary too. So I will participate together with asking for both, for whole form implementation and for grid's cells too.

Link to comment
Share on other sites

I'm working on this issue. Stay tuned!

 

I have no doubts that you have this in mind. We all know about your work, and that there are other issues, may be more relevant for the well function of the framework, so they are taking your time, but later will be time for this.

 

Thank you once again and I trust in you.

Link to comment
Share on other sites

In the case of grids it is necessary too. So I will participate together with asking for both, for whole form implementation and for grid's cells too.

 

Agree with these too..

Thanks Farshad.....

 

In the mean time, I manage to overcome with the following javascript that I put in the ServerModule.CustomFiles (I got this from extJS forum):

Ext.override(Ext.form.FormPanel, {
enterToTab:true,
autoFocus: true,
initEvents: Ext.form.FormPanel.prototype.initEvents.createSequence	(function(){
	if(this.autoFocus){
		this.on('afterrender', function(){
			this.focusFirstEnabledField(true, 500);
			
		},this)
	}
}),
focusFirstEnabledField: function(){
	var i = this.getFirstEnabledField();
	if(i){
		i.focus.apply(i,arguments);
	}
	return i;
},
getFirstEnabledField: function(){
	var x = null;
	Ext.each(this.form.items.items, function(i){
		if((!i.hidden)&&(!i.disabled)){
			x = i;
			return false;
		}
	},this)
	return x;
},
initFields:Ext.form.FormPanel.prototype.initFields.createSequence(function(ct, c) {
	this.form.items.each(function(f){
		f.form = this.form;
		f.formPanel = this;
		
		var nf = this.form.items.itemAt(this.form.items.indexOf(f)+1)
		if (nf){
			f.nextField = nf
		}
		delete nf;
		
		var pf = this.form.items.itemAt(this.form.items.indexOf(f)-1)
		if (pf){
			f.priorField = pf
		}
		delete pf;
		
		if(this.enterToTab){
			f.on('specialkey', function(field, e){
				if (e.getKey() == e.RETURN){
					var prop = (e.shiftKey ? 'priorField' : 'nextField');
					if (field[prop]){
						field[prop].focus(true);
					}
				}
			},this)
		}
	},this)
})
})

 

But, there's a problem with TUniDateTimePicker, because TUniDateTimePicker is always created last with UniGUI (I've already post this on this forum), so, the TUniDateTimePicker will not get focus on enter according to its order.

 

For other component of UniGui, it works well.

Link to comment
Share on other sites

  • 7 years later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...