Author: jcrowley
Date: 2007-06-27 14:42:53 -0700 (Wed, 27 Jun 2007)
New Revision: 5538

Modified:
   openlaszlo/branches/legals/lps/components/lz/menu.lzx
Log:
Change 20070625-jcrowley-T by [EMAIL PROTECTED] on 2007-06-25 23:39:40 PDT
    in /Users/jcrowley/src/svn/openlaszlo/legals-safe
    for http://svn.openlaszlo.org/openlaszlo/branches/legals

Summary: Bad placement for empty menus

New Features:

Bugs Fixed: LPP-3399

Technical Reviewer: pbr
QA Reviewer: max
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details: Contributor fix from Andre Bargull.
    

Tests: Ran example from LPP-3399 in modified branch versus unmodified;
        noted the problem was fixed in the modified.



Modified: openlaszlo/branches/legals/lps/components/lz/menu.lzx
===================================================================
--- openlaszlo/branches/legals/lps/components/lz/menu.lzx       2007-06-27 
18:00:30 UTC (rev 5537)
+++ openlaszlo/branches/legals/lps/components/lz/menu.lzx       2007-06-27 
21:42:53 UTC (rev 5538)
@@ -11,6 +11,15 @@
         <frame src="resources/menu/menu_arrow_lft.swf"/>
     </resource>
 
+    <!-- LPP-3399 -->
+    <class name="menutrackgroup" extends="basetrackgroup" >
+      <method name="addSubview" args="sv" >
+        if( !(sv instanceof lz.menu) ){
+          super.addSubview.apply( this, arguments );
+        }
+      </method>
+    </class>
+
     <!-- class: menubar -->
     <class name="menubar"
            extends="basecomponent" focusable="false">
@@ -45,7 +54,7 @@
 
         <!-- a basetracker to hold and track the menuButtons when the mouse is 
              down -->
-        <basetrackgroup name="mbarcontent" 
+        <menutrackgroup name="mbarcontent" 
                         layout="axis:x; spacing:-2"
                         deactivateevents="[]" height="100%"/> 
 
@@ -484,7 +493,10 @@
         </handler>
         
         <!--- @keywords private -->
-         <handler name="onconstruct" >
+        <attribute name="_menuitems" value="null" />
+        
+        <!--- @keywords private -->
+         <method name="init" >
             // create a floating list. Though the parent for this floating
             // list is this menu, the floating list will be created on the
             // canvas and its owner attribute will point to this menu.
@@ -500,7 +512,7 @@
                              { attach:'bottom',
                                attachoffset:-2,
                                width:w,
-                               shadowcrn:1 });  
+                               shadowcrn:1 }, this._menuitems);  
                                // border_top:0, border_bottom:0,
             } else if ( (this.parent) instanceof  lz.menuitem ) { 
                 // menu's parent is a menuitem so attach the floatinglist to 
@@ -510,7 +522,7 @@
                              { attach:'right',
                                width:w,
                                issubmenu:true, 
-                               shadowcrn:2 });  
+                               shadowcrn:2 }, this._menuitems);
             } else {
                 // menu's parent is some other type of view so attach the 
                 // floatinglist to the value of 'attach' attribute
@@ -518,7 +530,7 @@
                 this.flist = new menufloatinglist(this,
                              { attach:atch,
                                width:w, 
-                               shadowcrn:1 });             
+                               shadowcrn:1 }, this._menuitems);
             }
             
             // By default the floating list's target will be constrained to the
@@ -529,7 +541,7 @@
                 // Since the parent is a menubar ...
                           
                 // Create a menubutton and have the menu keep a reference to 
it.
-                this._menubutton = new menubutton( parent,{text:this.text}, 
null, true);
+                this._menubutton = new menubutton( parent,{text:this.text}, 
null, false);
                 
                 //Likewise, have the menubutton keep a reference to this menu
                 this._menubutton._menuref = this;
@@ -554,21 +566,21 @@
                 // have the menuitem keep a reference to its submenu
                 this.parent._submenu = this;
             } 
-        </handler>
-        
-        <!--- @keywords private -->
-         <method name="init" >
+            
             // need to wait until here when the width and heights of the target
             // set before I activate the constraints
-            super.init();
+            super.init.apply( this, arguments );
             this.flist.setAttachTarget(this._flisttarget);
         </method>
         
-        <!-- instantiate children of menu in its floatinglist instead of 
itself.
+        <!-- old: instantiate children of menu in its floatinglist instead of 
itself.
+             new: save childrenarray in the private field _menuitems
              this method is called autmatically.
              @param array childrenarray: an array of nodes to be created-->    
            
         <method name="createChildren" args="childrenarray" ><![CDATA[
-            this.flist.createChildren(childrenarray);
+            super.createChildren( [] );
+            this._menuitems = childrenarray;
+            //this.flist.createChildren(childrenarray);
         ]]></method>
         
         <!--- @keywords private -->


_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Reply via email to