DougHennig / Ribbon

A Microsoft Office 365-like ribbon control for VFP forms
24 stars 11 forks source link

Menu for AllowShowTabsOnly #17

Closed LOGOmichael closed 1 year ago

LOGOmichael commented 1 year ago

๐Ÿ“ What's going on?

If clicked on the RibbonDisplayButton, nothing seems to happen. "Nothing" means: not even the expected menus shows up.

This Bug happens on a ribbon-usage on _SCREEN. This might be happening due to this special usage, but as the menu-use on the sfRibbonToolbarButton is working just fine, there must be more to it.

โœ”๏ธ Expected result

The intended menu should show up and be selectable to the user.

โŒ Actual result

If the menu-form-shows-in-taskbar-bug is not yet fixed, one can see that the menu shows up (in the taskbar) for a few milliseconds before dissapearing again.

There seems to be something going on that lets the menu dissapear right after ShowMenu()

Test If i disable the Menu-Timer for good, the menu stays on and does not dissapear.

image

Of course a disabled timer is not a solution as it is responsible for the check-for-outofForm-Clicks. But the menu itself shows up and is workable just fine.

image

Yepp... the position is screwed up, but that is another problem i will put in another report as it might be easier to work on the individual tasks... Report for the wrong position is: https://github.com/DougHennig/Ribbon/issues/19#issue-1814444263

So the test with deactivated menuform-timer proofs that the thing itself is working, but the menu to get to the point is simply dissapearing due to timer-action.

I have not (yet) find a solution to that and if this behavior is special to the oRibbon-on-_SCREEN-usage, but something lets the timer immediately "detect" an out-of-form-mouseclick. ...which then shuts down the menu-form right away.

I will edit/add further infos on this if i will find anything new, but until now... used on _SCREEN, this won't work.

VfpImaging commented 1 year ago

On my side, I am implementing it to FoxyPreviewer and found an issue, still not investigated, when the button menu keeps active even if the Ribbon form is released. That might be related to the Timer as well, but further investigations are needed on my side because the Report Preview engine has some specific codes related to avoiding the _Screen to be repainted to avoid flickering. This sometimes causes some Windows events to be ignored if not managed properly. Anyway, with or without a timer, the menus should be closed when the form and the ribbon are closed.

image

If I close the whole form, if the menu was opened, it is not released immediately - it takes about 10 seconds to auto release:

image

I will try to dig into this later as well, and hopefully will get back with a solution

VfpImaging commented 1 year ago

The menu kept alive after the form release was solved after releasing the ribbon on Destroy() event by Thisform.RemoveObject("oRibbon")

LOGOmichael commented 1 year ago

Hi @DougHennig

after some deepdiving into obscure debugging i found the "path" that is happening when used in _SCREEN scenario.

The Code in TimerEvent uses some very well organized boolean logic shorttrips where the second part after AND is only running when the first part of AND is .T. anyway. Thats great so far, but unfortunately the very special "button" for RibbonDisplayButton is missing something to behave just the same as any other ribbon-button: the TYPE-Property.

Without it, the logic in the timerevent is using the wrong path and always comes to the conclusion that llClickedOutsideForm is ALWAYS True... which of course it is not.

I helped myself by adding an addProperty in the INIT of the Container-Class holding the actual imgButton and setting the value to "Button". So the little "down"-Button on the Ribbon is not emulating to be a ribbon-Button.

image

With that, the logic-path and conclusion is identical to that of the ribbon buttons and is working perfectly.

If you can verify that this change will not break anything in "normal" Form-usage, perhaps you could add the "Type" Property with Value "Button" by default for this Button. ...or include the addProperty like i did ;-)

I am fine now with the workaround solution of including it myself ๐Ÿ˜„

Thanks for a marvelous work of art. Best regards from Bremen, Germany

DougHennig commented 1 year ago

Thanks! Since there is already a Type property for the button, I simply set it to "Button" and that fixed the problem. See the new release.