Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Submenu hides parentmenu when placed near the right border
Submenu hides parentmenu when placed near the right border [message #1740883] Fri, 19 August 2016 06:54 Go to next message
Eclipse UserFriend
Hi,

i have a menu in the top right corner of my application. If this menu has submenus, those items are shown over their parentmenu.
index.php/fa/26794/0/

As long as all labels are shorter than the lables in the parentmenu, this is not a problem. But if there is one long label, the parentmenu will be completly hidden by the submenu and you can't get back to the parentmenu.
index.php/fa/26795/0/

In SWT submenus pop up on the left of their parentmenu, if there is not enough space.

Is there any property to enable the SWT-bahaviour?

If not, is there a way to reposition the submenu? I tried different Listeners (Show, Selection), but Menu.setLocation(...) didn't seem to work.

Regards
Magnus
  • Attachment: menu.png
    (Size: 2.25KB, Downloaded 372 times)
  • Attachment: submenu.png
    (Size: 2.34KB, Downloaded 368 times)

[Updated on: Fri, 19 August 2016 06:56] by Moderator

Re: Submenu hides parentmenu when placed near the right border [message #1742550 is a reply to message #1740883] Sun, 04 September 2016 19:55 Go to previous message
Eclipse UserFriend
I raised this as https://bugs.eclipse.org/bugs/show_bug.cgi?id=372176

I use these patches and build my own version
diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/Popup.js b/bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/Popup.js
index 7af0862..35e7b45 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/Popup.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/Popup.js
@@ -286,6 +286,16 @@ rwt.qx.Class.define("rwt.widgets.base.Popup",
           left = docWidth - restrictToPageRight - width;
         }
 
+        if( this._opener instanceof rwt.widgets.MenuItem ) {   
+        	var parentMenu = this._opener.getParentMenu();
+	        var parentLeft = parentMenu.getLeft();
+	        if (parentLeft) {
+		        if (left < parentLeft) { 
+		        	left = parentLeft - width;
+		        } 
+	        }
+	    }
+
         if (top + height > docHeight - restrictToPageBottom) {
           top = docHeight - restrictToPageBottom - height;
         }

diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/Popup.js b/bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/Popup.js
index 35e7b45..b1df5dd 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/Popup.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/Popup.js
@@ -288,9 +288,10 @@ rwt.qx.Class.define("rwt.widgets.base.Popup",
 
         if( this._opener instanceof rwt.widgets.MenuItem ) {   
         	var parentMenu = this._opener.getParentMenu();
-	        var parentLeft = parentMenu.getLeft();
-	        if (parentLeft) {
-		        if (left < parentLeft) { 
+	        var parentLeft = parentMenu.getLeftValue();
+			var parentWidth = parentMenu.getWidthValue();
+	        if (parentLeft && parentWidth) {
+		        if (left < (parentLeft + parentWidth - 5)) { 
 		        	left = parentLeft - width;
 		        } 
 	        }


As they are, I don't think they're good enough to be contributed. I'm not sure how it will handle very narrow windows or very wide menus

I think with just the first patch, the sub-menu will only be moved from its usual position if it fully covers the parent menu. With the second patch, this behaviour is changed so the sub-menu is moved to the left if it would cover any of the parent menu - which is how SWT on windows behaves.

I don't think my fix is in the correct place in the code, there are no tests covering it and the hard-coded '5' isn't going to work with theme support.
Previous Topic:RAP 3.1 Circle Clipping
Next Topic:The parameter 'uiSession' must not be null.
Goto Forum:
  


Current Time: Mon Jul 07 00:02:43 EDT 2025

Powered by FUDForum. Page generated in 0.07622 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top