Revision: 3761
          http://vexi.svn.sourceforge.net/vexi/?rev=3761&view=rev
Author:   clrg
Date:     2009-11-25 01:56:26 +0000 (Wed, 25 Nov 2009)

Log Message:
-----------
Fixes for selectables, especially when adding/removing items

Modified Paths:
--------------
    trunk/widgets/org.vexi.widgets/src/org/vexi/lib/role/selectable.t
    trunk/widgets/org.vexi.widgets/src/org/vexi/lib/role/selectcontainer.t
    trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/combo.t

Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/role/selectable.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/role/selectable.t   
2009-11-22 02:28:47 UTC (rev 3760)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/role/selectable.t   
2009-11-25 01:56:26 UTC (rev 3761)
@@ -235,6 +235,9 @@
             if (oldg) {
                 // remove v from oldg
                 oldg.members.remove(v);
+                if (oldg.selected == v) {
+                    oldg.selected = null;
+                }
             }
             if (newg) {
                 // add to group
@@ -243,7 +246,9 @@
                 } else {
                     newg.members.push(v);
                 }
-            } else return null;
+            } else {
+                return null;
+            }
         }
         if (v.selected) {
             // initialize as selected

Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/role/selectcontainer.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/role/selectcontainer.t      
2009-11-22 02:28:47 UTC (rev 3760)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/role/selectcontainer.t      
2009-11-25 01:56:26 UTC (rev 3761)
@@ -64,23 +64,21 @@
         if (c) {
             if (g) {
                 // insert into existing group
+                // NB write trap on selectable.group handles assignment
                 c.group = g;
-                // respect selected state of c
-                if (c.selected and !g.selected) {
-                    g.selected = c;
-                }
             } else {
                 // no group yet, create one
+                // NB read trap on selectable.group handles group creation
                 g = c.group;
                 if (g==null) {
                     // not a selectable
                     return;
                 }
+                t.v_listgroup = g;
                 // keep selected in view if a scrolling widget
                 if (trapee.th_scroll) {
                     g.selected ++= trapee.syncView;
                 }
-                t.v_listgroup = g;
                 // respect selected state of c
                 if (c.selected) {
                     t.v_listgroup.selected = c;
@@ -93,7 +91,7 @@
     static.childrenRemoved = function(c) {
         if (c==null) {
             var _c = trapee[trapname];
-            if (_c) {
+            if (_c and _c.v_group) {
                 _c.group = null;
             }
         }

Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/combo.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/combo.t      
2009-11-22 02:28:47 UTC (rev 3760)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/combo.t      
2009-11-25 01:56:26 UTC (rev 3761)
@@ -52,7 +52,7 @@
             t.v_edit.KeyPressed = v;
             if (t.matchtext) {
                 if (t.v_edit.text == "") {
-                    static.unmatch(t);
+                    static.unmatch(t.v_group);
                 } else if (!t.popped) {
                     t.popup = true;
                 }


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
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to