incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtu...@apache.org
Subject svn commit: r494938 - in /incubator/xap/trunk/src/xap: bridges/xap/ListBoxBridge.js widgets/ListBox.js
Date Wed, 10 Jan 2007 19:22:29 GMT
Author: mturyn
Date: Wed Jan 10 11:22:28 2007
New Revision: 494938

URL: http://svn.apache.org/viewvc?view=rev&rev=494938
Log:
http://issues.apache.org/jira/browse/XAP-242
Cause:  the select box redraw was making the box lose focus.
Fix: added a focus() statement called from XapComboBox.onChange();
this is unpleasant and should be revisited when possible, but
is permissible because the onChange() is triggered when the user
has selected a new option (by a CR or a mouse-up, at which point the
tool _should_ have the focus.

Modified:
    incubator/xap/trunk/src/xap/bridges/xap/ListBoxBridge.js
    incubator/xap/trunk/src/xap/widgets/ListBox.js

Modified: incubator/xap/trunk/src/xap/bridges/xap/ListBoxBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/xap/ListBoxBridge.js?view=diff&rev=494938&r1=494937&r2=494938
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/xap/ListBoxBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/xap/ListBoxBridge.js Wed Jan 10 11:22:28 2007
@@ -53,7 +53,7 @@
 	}
 
 	
-	dojo.event.connect(this.getPeer().select,"onchange",this,"onChange") ;
+	dojo.event.connectBefore(this.getPeer().select,"onchange",this,"onChange") ;
 	dojo.event.connect(this.getPeer(),"onStructureChange",this,"revalue") ;		
 
 	// Now we'll pass on events....
@@ -98,8 +98,10 @@
 	this.fireEvent("onStateChange",null,null,clientEvent);	
 	
 	//combo boxes tend to have dsipaly problems:
-	if( this.getPeer().select.size == 1 ){
-		this.getPeer().refreshSelectBox() ;
+	if( this.isChildOfComboBox ){
+		// true == "force focus back here",
+		// which is all right in this case
+		this.getPeer().refreshSelectBox(true) ;
 	}
 
 }

Modified: incubator/xap/trunk/src/xap/widgets/ListBox.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/ListBox.js?view=diff&rev=494938&r1=494937&r2=494938
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/ListBox.js (original)
+++ incubator/xap/trunk/src/xap/widgets/ListBox.js Wed Jan 10 11:22:28 2007
@@ -209,11 +209,18 @@
 		}
 		return result ;
 	}, // getTextValuePairs
-	refreshSelectBox:function(){
+	refreshSelectBox:function(bForceFocus){
 		var parentNode = this.select.parentNode ;
 		if( parentNode ){
 			var next = this.select.nextSibling ;
+			// no remove necessary; this seems to work under IE,
+			// which is where it's needed, even though
+			// the net effect is naught, because you can't 
+			// insert the same child twice:
 			parentNode.insertBefore(this.select,next) ;
+		}
+		if(bForceFocus){
+			this.select.focus() ;
 		}
 	},
 	onStructureChange:function(){



Mime
View raw message