Problem with Splitdropdown.

Jan 15, 2013 at 2:11 PM

Hi,

First of all this is great project. I have noticed problem with ribbon button with splitdropdown option on. When you press button, and choose item from dropdown list the button stays in pressed mode if dropdown item is outside ribbon area. To put it to normal state you have to move mouse again to ribbon area, but it doesn't work all the time. If there is an tooltip assigned to button it multiplies causing increase of memory usage constantly. Any tip how to fix it, except not using buttons with dropdown ;) ?

Jan 15, 2013 at 2:22 PM

This bug is fixed in new release. There is a high possibility that the ribbon DLL that you are using is an old version of ribbon.

You may try to download the new ribbon.

The issues that stated:

  1. Button Stays in pressed mode = fixed
  2. tooltip showed multiple times shown on parent item = fixed

but I can see there is a bug > tooltip is not showing on child dropdownitem.

Well, guess this will be fixed.

Jan 15, 2013 at 6:26 PM

Unfortunatelly new release didn't fix this bug for me. When button is pressed and new dialog opens (example print dlg), button stays pressed until it gots mouse over again. Anyway thanx for your hard work and help.

Jan 15, 2013 at 6:35 PM

Are you using Visual Studio 2008, I do face this before.

Try run the EXE directly. not by pressing F5 in Visual Studio.

Jan 15, 2013 at 6:46 PM

Okay, I think I get your problem.

try manually refresh the ribbon by reactivating the ribbonActiveTab. Example:

private void ribbonButton1_Click(object sender, EventArgs e)
{
    ribbon1.ActiveTab = ribbon1.ActiveTab;
    OpenAnyForm f = new OpenAnyForm();
    f.ShowDialog();
}

Jan 16, 2013 at 1:39 AM

by re-assigning the ActiveTab will force the ribbon to redraw.

ribbon1.ActiveTab = ribbon1.ActiveTab;

Jan 16, 2013 at 12:42 PM
Edited Jan 16, 2013 at 12:43 PM

Well,

It looked like a good idea, but it has nothing to do with ribbon redraw. I played a moment with this, and added

 

ribbon1.ActivateNextTab()

This should redraw tabcontrol, but when you select previous tab, the button stays selected. You have to move mouse over it to deselect. I will look more deeply inside the code then.

Jan 16, 2013 at 12:47 PM
Edited Jan 16, 2013 at 1:15 PM

well, can you upload a sample project that presents the scene?

So that I won't have to guess what is happening. I can have a better idea and look at the code and work on it directly.

Jan 22, 2013 at 3:59 AM

The problem here is that the button is still in the "Selected" state (meaning mouse is over it) and cannot be cleared until a mouse move is detected by the ribbon.  The Selected property is hidded from the outside world so you cant clear it manually.  You could change the selected property of the ribbon item and make it public and then you could clear it in the click event. However this would open up a can of worms to the unknowing programmer.  The ideal solution (the way I would do it) would be to add a private property to the ribbon called LastSelectedItem and anytime a ribbon item get selected it sets this property.  Then you can track what Item is currently under the mouse at any given time.  Then in the WndProc function for a mouse move messsage you can check if the X/Y is over the ribbon or not. If not then clear the selected item and redraw it.

So, I gave the solution so now lets see if someone can do it... :)

Jan 25, 2013 at 5:51 PM

Yes the problem is with OnMouseUp event that raised button. When u click button that opens form it doesn't return OnMouseUp event so the button stays pressed. I have made a quite nasty hack to the code to fix this, but it needs more attention.

Jan 28, 2013 at 9:27 AM

I am not 100% certain that I got you right - but if I did, this issue is already resolved by the version is sent to Kevin today. My guess is this is related to the RibbonItem where the OnClick is forwarded first and then the Orb closed. Additionally the "if (ClosesDropDownAt(Cursor.Position))" misses a screen to client coordinates conversion.