(Revisiting thread from last month) Persisting of custom attributes on the combo_box widget

Michael Flanagan <[email protected]>
Newsgroups gmane.comp.windows.devel.netwindows
Message-ID <[email protected]>
We had a discussion about this last month during which I submitted a 
working patch against head.

I've resync'd with head and merged my change into it. I'm once again 
submitting my implementation as a proposed solution.

--michael

_______________________________________________
The netWindows developers list: [email protected]
http://netwindows.org/mailman/listinfo/devel_netwindows.org
combo_box_widget.js.patch (text/plain, 1.3 KB)
Index: combo_box_widget.js
===================================================================
RCS file: /cvsroot/netwindows/netWindows/winScripts/widgets/combo_box_widget.js,v
retrieving revision 1.129
diff -u -r1.129 combo_box_widget.js
--- combo_box_widget.js	21 Jul 2003 06:31:33 -0000	1.129
+++ combo_box_widget.js	21 Jul 2003 23:16:52 -0000
@@ -270,6 +270,7 @@
 	}
 
 	this.clearAllGroups(); // defines groupDataArr and groupNamesArr
+	this.attributes = [];
 
 	this.focus = function(){
 		this.inputBox.focus();
@@ -278,6 +279,13 @@
 	this.doOnPlacement = function(){
 		this.checkValue(this.inputBox.value);
 	}
+	
+	this.getAttribute = function(attribute){
+		if (this.attributes[attribute])
+			return this.attributes[attribute];
+		else
+			return null;
+	}
 
 	this.makeGroupActive = function(){
 		this.makeAllGroupsActive(false);
@@ -1486,6 +1494,19 @@
 		with(cb.inputBox){
 			setAttribute("tabindex", ti);
 			tabIndex = ti;
+		}
+	}
+	
+	if(NWconfig["watchAttributes"]){
+		var attName=null;
+		var attVal=null;
+		for(var att=NWconfig["watchAttributes"].length-1; att>=0; att--){
+			attName = NWconfig["watchAttributes"][att];
+			attVal = __util__.getAttr(domNode, attName);
+			if(attVal){
+				cb.attributes[attName] = attVal;
+			}
+			attVal=null;
 		}
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.