Menu collapses despite "ExpandOnClick = true"...

Answered (Verified) This post has 1 verified answer and 6 replies

Top 50 Contributor
Posts: 111
wowa777 Posted: Mon Dec 21, 2009 @ 1:01 AM

I would like to have a menu that expands on click and after that stays open until someone clicks on an item or near the menu. In other words - I would like the same menu behaviour like in the "Core Menu Features" example when ExpandOnClick is activated. Further I would like to have an image as the top item instead of text. And this seems to be a problem. Because if I have text as top item - the menu behaves as wanted. But as soon as I put an image as top item the behaviour is as following:

- Clicking on the top item --> menu expands
- Positioning the mouse somewhere near the menu --> menu stays expanded
- Positioning the mouse on the top item and SLOWLY mouse out in the LEFT or TOP position --> as soon as the mouse is not on the top item the menu collapses! (and expands again without clicking if you move the mouse back over the top item)

How can I remove this?

Answered (Verified) Verified Answer

Top 10 Contributor
Posts: 6,014
Answered (Verified) stephen Posted: Wed Dec 23, 2009 @ 10:41 AM
Verified by wowa777

What you might be seeing is because when you use an icon, the menu renders a table (a column for the icon, a column for the text). It might be this element that's causing you issues. In your case, you don't need an icon- you're trying to set the set entire item to be an image (if I'm reading this right).  If that's the case, set the ImageUrl property- take a look at the menu design-> all images demo to see what I mean.

Stephen Hatcher, Developer Support Manager

All Replies

Top 50 Contributor
Posts: 111
wowa777 Posted: Mon Dec 21, 2009 @ 1:13 AM

This is how I'm getting an image to be the top menu item instead of text. Maybe here something is going wrong:

ComponentArt.Web.UI.MenuItem topItem = new ComponentArt.Web.UI.MenuItem();
topItem.Look.LeftIconUrl = "menu.gif";
topItem.LookId = "TopItemLook";
menu.Items.Add(topItem);
Top 50 Contributor
Posts: 111
wowa777 Posted: Mon Dec 21, 2009 @ 2:25 AM
After some testing I found out that this is - I wouldn't call it a bug but maybe - a poor side effect. The menu should collapse only if you click somewhere AND in case that you mouseover another top item. Then the last showed menu should collapse and the menu of the actual top item should expand. This is the reason why my menu collapsed when my mouse slowly left the menu icon.

You can see this in the CA Menu example "Design Examples" - "MS Office 2003". There's a little space between the top items and the menu background boundaries. If you click on one of the top items and then put the mouse exactly in this area between the top item and the bachground boundaries you will see that the menu collapses.

In my case I'm having only one top item which is an image without text. I could now improve the behaviour by setting "TopGroupItemSpacing = 0" hoping that this would eliminate the space where you can put the mouse to get in this area where the menu is collapsing but it doesn't work perfect.

You can see what I mean in the "Core Menu Features" example. Activate "ExpandOnClick", click on "File" and the move the mouse to the left side of the menu. Although there is no visible space between the top item and the complete menu, it collapses.

Is there a way to avoid this?
Top 50 Contributor
Posts: 111
wowa777 Posted: Wed Dec 23, 2009 @ 12:46 AM
Here's another issue I found out. Go to the Core Menu Features example and make the following settings:

ExpandSlide: None
ExpandTransition: None
ExpandDuration: 0
ExpandDelay: 0
ExpandOnClick: true

Let the collapse properties as default.

Now the problem that the menu collapses when moving the mouse over the top menu item "File" to the left side is extremely visible! And the interesting thing is that the more milliseconds the ExpandDelay goes, the less is the problem! Try the same with ExpandDelay = 500. You will see that you have to leave the mouse staying for some time in the left corner to see the menu collapse. This doesn't make sense to me. I would have expected that the CollapseDelay is responsible for this behaviour.

Unfortunately setting ExpandDelay to 500 or more is not a solution for me. This causes another problem... If the user is quick, he will click on the top item and move the mouse down to where the menu should become visible. But when having a big expandDelay time, the menu won't expand if the mouse leaves the top menu item! This behavior you can also see in the Core Menu Features Example with the settings above.

Please find a good solution for all this!
Top 10 Contributor
Posts: 6,014
Answered (Verified) stephen Posted: Wed Dec 23, 2009 @ 10:41 AM
Verified by wowa777

What you might be seeing is because when you use an icon, the menu renders a table (a column for the icon, a column for the text). It might be this element that's causing you issues. In your case, you don't need an icon- you're trying to set the set entire item to be an image (if I'm reading this right).  If that's the case, set the ImageUrl property- take a look at the menu design-> all images demo to see what I mean.

Stephen Hatcher, Developer Support Manager
Top 50 Contributor
Posts: 111
wowa777 Posted: Mon Dec 28, 2009 @ 12:13 AM
Thanks for this great hint, Stephen! I tried this and now it really works like it should!
Top 10 Contributor
Posts: 6,014
stephen Posted: Tue Dec 29, 2009 @ 6:50 AM

Great- glad I could help.

Stephen Hatcher, Developer Support Manager
Page 1 of 1 (7 items)