Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

TLMDSimplePanel: AllowMoving + PopupMenu

edited September 2012 in LMD-Tools Vote Up0Vote Down
A project I am working on has a TLMDSimplePanel which needs to have AllowMoving and AllowSizing (with size grip) set to True. It also needs to use a PopupMenu.

I've noticed that if AllowMoving is set to True, then the PopupMenu's AutoPopup feature doesn't seem to work. I've tried various implementations using combinations of OnMouseDown, OnMouseActivate, and OnContextPopup, but none have fully worked properly.

What is the best way to implement having AllowMoving set to True, while also using a PopupMenu on the same panel?


  • 4 Comments sorted by Votes Date Added
  • Simple solution:
    Place (invisible) panel on it - for this one popupmenu will work (set Align to alClient). SimplePanel can still be moved by using lower size grip area (or provide movable areas by using AlignWithMargin of the invisible panel).
    There is no other "automatic" way.
  • Thanks for the response.

    For one type of panel in the project, it's strongly preferred that any of the visible area of the TLMDSimplePanel accommodate the right-click Popup Menu. How could that be accomplished programmatically? I don't mind manually calling the popup via OnMouseDown or other events, or even (if necessary) inheriting from TLMDSimplePanel and overriding some methods; just struggling with where to reliably intercept things.

    Ideally, if not an "automatic" approach (which you've answered above already as not doable), then by some approach which leaves the AllowMoving functionality unscathed, but adds some programmatic implementation to facilitate TPopupMenu integration across the entire panel. Possible? (Surely it must be, somehow..)

    Thanks again for your time, and quick response.
  • >>, it's strongly preferred that any of the visible area of the <<
    Sorry, no simple way. Check the source and you will see that moving/resizing feature is some sort of API hack and as a result several standard events (e.g. mouseclicks) are not generated when active. 
    If full freedom like in your case is required, sizing and moving feature must be implemented in different way (using dockingpanels or else).

Sign In or Register to comment.