Revision: 3619
          http://vexi.svn.sourceforge.net/vexi/?rev=3619&view=rev
Author:   clrg
Date:     2009-08-24 16:38:28 +0000 (Mon, 24 Aug 2009)

Log Message:
-----------
Don't set value on popdown if disabled, other minor updates

Modified Paths:
--------------
    trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/option.t
    trunk/widgets/org.vexi.widgets/src_dev/visualtest/option.t

Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/option.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/option.t     
2009-08-24 12:54:10 UTC (rev 3618)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/option.t     
2009-08-24 16:38:28 UTC (rev 3619)
@@ -70,9 +70,12 @@
     /** applied to list container */
     static.contentLeaveEvent = function(v) {
         cascade = v;
-        if (trapee.v_option.v_listgroup) {
-            var s = trapee.v_option.v_listgroup.selected;
-            if (s and s.selected) s.selected = false;
+        var g = trapee.v_option.v_listgroup;
+        if (g) {
+            var s = g.selected;
+            if (s and s.selected) {
+                s.selected = false;
+            }
         }
     }
     
@@ -85,25 +88,29 @@
     /** initialize content list */
     static.contentThemeWrite = function(v) {
         cascade = v;
-        trapee.v_content.Leave ++= static.contentLeaveEvent;
-        trapee.v_content.Release1 ++= static.contentReleaseEvent;
-        trapee.v_content.v_option = trapee;
+        var vc = trapee.v_content;
+        vc.Leave ++= static.contentLeaveEvent;
+        vc.Release1 ++= static.contentReleaseEvent;
+        vc.v_option = trapee;
     }
     
     /** disabled option must be popped down */
     static.enableWrite = function(v) {
+        cascade = v;
         var t = trapee;
         if (t.v_popbox and t.popped and !v) t.popdown = true;
         if (t.th_button) t.th_button.enabled = v;
-        cascade = v;
     }
     
     /** set value on popdown to selected item */
     static.popdownWrite = function(v) {
         var t = trapee;
-        var s = t.v_listgroup ? t.v_listgroup.selected : null;
-        if (s and s.selected and s!=t.value) {
-            t.value = s.value;
+        if (t.enabled) { 
+            // REMARK: must do this before cascade as 
+            var s = t.v_listgroup ? t.v_listgroup.selected : null;
+            if (s and s.selected and s!=t.value) {
+                t.value = s.value;
+            }
         }
         cascade = v;
     }
@@ -113,7 +120,7 @@
         cascade = v;
         var t = trapee;
         var s = t.v_listgroup ? t.v_listgroup.selected : null;
-        if (t.value and !s) {
+        if (t.value and (!s or t.value!=s.value)) {
             var n = t.numchildren;
             for (var i=0; n>i; i++) {
                 if (t[i].value == t.value) {
@@ -131,10 +138,10 @@
         var s = t.v_listgroup ? t.v_listgroup.selected : null;
         cascade = v;
         // search for value matches in children
-        if (oldv != v and !t.popped) {
+        if (oldv != v) {
             if (v==null) {
                 if (s and s.selected) s.selected = false;
-            } else {
+            } else if (!s or v != s.value) {
                 var n = t.numchildren;
                 for (var i=0; n>i; i++) {
                     if (t[i].value == t.value) {
@@ -148,7 +155,7 @@
         // value has not changed but missing selected
         if (!s and oldv == v) return;
         // assign appropriate text content
-        t.text = t.showvalue ? t.value : s ? s.text : "";
+        t.text = t.showvalue ? t.value : s ? s.text : t.value;
     }
     
     /** focusable integration */

Modified: trunk/widgets/org.vexi.widgets/src_dev/visualtest/option.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src_dev/visualtest/option.t  2009-08-24 
12:54:10 UTC (rev 3618)
+++ trunk/widgets/org.vexi.widgets/src_dev/visualtest/option.t  2009-08-24 
16:38:28 UTC (rev 3619)
@@ -1,12 +1,28 @@
 <vexi xmlns:ui="vexi://ui" xmlns:w="vexi.widget">
     <w:surface />
-    <ui:box>
+    <ui:box orient="vertical" shrink="true" width="500" height="500">
         <ui:box />
         <ui:box shrink="true">
             <ui:box text=" Option " />
             <w:option id="o" shrink="true">
                 <w:item text="Value A" selected="true" />
                 <w:item text="Value B" />
+                <w:item text="Value A" selected="true" />
+                <w:item text="Value B" />
+                <w:item text="Value A" selected="true" />
+                <w:item text="Value B" />
+                <w:item text="Value A" selected="true" />
+                <w:item text="Value B" />
+                <w:item text="Value A" selected="true" />
+                <w:item text="Value B" />
+                <w:item text="Value A" selected="true" />
+                <w:item text="Value B" />
+                <w:item text="Value A" selected="true" />
+                <w:item text="Value B" />
+                <w:item text="Value A" selected="true" />
+                <w:item text="Value B" />
+                <w:item text="Value A" selected="true" />
+                <w:item text="Value B" />
             </w:option>
             <w:button id="b1" text="Set Value A" />
             $b1.action ++= function(v) { $o.value = "Value A"; return; }
@@ -14,10 +30,13 @@
         <ui:box />
         <ui:box shrink="true">
             <ui:box text=" Combo " />
-            <w:combo shrink="true" minwidth="80">
+            <w:combo id="c" shrink="true" width="120">
+                <w:item text="foo" />
                 <w:item text="Value A" selected="true" />
                 <w:item text="Value B" />
             </w:combo>
+            <w:button id="b2" text="Set Value A" />
+            $b2.action ++= function(v) { $c.value = "Value A"; return; }
         </ui:box>
         <ui:box />
         vexi.ui.frame = thisbox;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Vexi-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to