Revision: 4688
          http://sourceforge.net/p/vexi/code/4688
Author:   mkpg2
Date:     2014-04-21 23:18:17 +0000 (Mon, 21 Apr 2014)
Log Message:
-----------
New property. focusmanager.lastFocus.
- exposes last focus, when adding elements can be useful especially if added 
element is not directly a focusable (but rather wraps a focusable).

Modified Paths:
--------------
    branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/focusable.t
    
branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/focusmanager.t

Added Paths:
-----------
    branches/vexi3/org.vexi-vexi.widgets/src_poke/poke/role/
    branches/vexi3/org.vexi-vexi.widgets/src_poke/poke/role/poke_focusmanager.t

Modified: 
branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/focusable.t
===================================================================
--- branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/focusable.t 
2014-04-18 00:35:32 UTC (rev 4687)
+++ branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/focusable.t 
2014-04-21 23:18:17 UTC (rev 4688)
@@ -75,13 +75,11 @@
     static.focusedWrite = function(v) {
         // REMARK: the following sequence could be more compact
         // but it is easier to follow in the more explicit form
-        var s = trapee.surface;
-        var model = s ? s.focus : null;
+        const model = trapee.surface?.focus;
         if (model==null) {
             cascade = false;
         } else if (v) {
-            var f = trapee.focusable;
-            if (f) {
+            if (trapee.focusable) {
                 model.focusrequest = trapee;
                 cascade = model.setFocus(trapee, true);
             }

Modified: 
branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/focusmanager.t
===================================================================
--- 
branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/focusmanager.t  
    2014-04-18 00:35:32 UTC (rev 4687)
+++ 
branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/focusmanager.t  
    2014-04-21 23:18:17 UTC (rev 4688)
@@ -23,7 +23,7 @@
         var surfaceFocused = false;
         
         // the focus list for this surface
-        var fvector = new .util.vector();
+        const fvector = new .util.vector();
         
         // access to the model and current focus
         model.focus ++= .util.common..readOnly;
@@ -132,7 +132,7 @@
                 nf = fvector.first;
             }
             while (nf != v) {
-                if (nf.focusable) {
+                if (nf.focusable) {                
                     return nf;
                 }
                 nf = fvector.after(nf);
@@ -164,6 +164,10 @@
             return v.focusable ? v : null;
         }
         
+        
+        model.lastFocus ++= function() { return fvector.last; };
+        
+        
         /** give the requested widget the focus */
         surface.event._Press1 ++= function(v) {
             // clear focusrequest as it gets set by manual focused puts

Added: 
branches/vexi3/org.vexi-vexi.widgets/src_poke/poke/role/poke_focusmanager.t
===================================================================
--- branches/vexi3/org.vexi-vexi.widgets/src_poke/poke/role/poke_focusmanager.t 
                        (rev 0)
+++ branches/vexi3/org.vexi-vexi.widgets/src_poke/poke/role/poke_focusmanager.t 
2014-04-21 23:18:17 UTC (rev 4688)
@@ -0,0 +1,26 @@
+<!-- public domain -->
+
+<vexi xmlns:ui="vexi://ui" xmlns:w="vexi.widget">
+    <w:surface />
+    <ui:box>
+        <w:check id="b1" name="b1"/>
+        <ui:Box id="a1" />
+        <w:check id="b2" name="b2" />
+        <ui:Box id="a2" />
+        
+        
+        $b1.selected ++= function(v){
+            cascade = v;
+            $a1.clear();
+            if(v){
+                const f = new w.textfield(); 
+                f.name="a1";
+                $a1[0] = f;
+                f.surface.focus.addFocus(f,$b1);
+            }
+        };
+         
+        vexi.ui.frame = thisbox;
+        
+    </ui:box>
+</vexi>
\ No newline at end of file

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


------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to