Recent

Author Topic: Learn how to (un)dock a TPanel  (Read 2638 times)

Hansvb

  • Hero Member
  • *****
  • Posts: 805
Re: Learn how to (un)dock a TPanel
« Reply #15 on: February 23, 2025, 03:03:20 pm »
The ratio length width has no influence on dragging and docking. You can easily test if you make the panel long and narrow or put an extra dock panel on the form with a different length width ratio.

msintle

  • Sr. Member
  • ****
  • Posts: 313
Re: Learn how to (un)dock a TPanel
« Reply #16 on: February 25, 2025, 11:02:53 am »
Thanks!

Is there also a way to make it work without creating the forms dynamically upon undocking, but having the forms pre-existing (with their own captions, settings, tool-window border styling, etc.)?

Hansvb

  • Hero Member
  • *****
  • Posts: 805
Re: Learn how to (un)dock a TPanel
« Reply #17 on: February 25, 2025, 06:06:13 pm »
Hi, probably. You can probably fake docking with your own forms. But then I would rather see if anchordocking can be used in your own project.

msintle

  • Sr. Member
  • ****
  • Posts: 313
Re: Learn how to (un)dock a TPanel
« Reply #18 on: February 25, 2025, 07:22:15 pm »
Anchordocking results in the problem I had just described above.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12206
  • FPC developer.
Re: Learn how to (un)dock a TPanel
« Reply #19 on: February 25, 2025, 07:28:15 pm »
(btw, be careful if you have tpopupmenus active on that panel)

msintle

  • Sr. Member
  • ****
  • Posts: 313
Re: Learn how to (un)dock a TPanel
« Reply #20 on: February 26, 2025, 12:49:05 am »
(btw, be careful if you have tpopupmenus active on that panel)

I do, why?

Hansvb

  • Hero Member
  • *****
  • Posts: 805
Re: Learn how to (un)dock a TPanel
« Reply #21 on: March 01, 2025, 08:59:05 am »
Can you attach an example with the Anchordocking?

Hansvb

  • Hero Member
  • *****
  • Posts: 805
Re: Learn how to (un)dock a TPanel
« Reply #22 on: March 05, 2025, 08:18:35 pm »
@msintle, The answer was right in front of me. For the time being I have given up docking but if I need it then this is the starting point:
Quote
https://wiki.freepascal.org/Anchor_Docking#Procedure_to_create_all_other_forms_by_name
and then:
Quote
You will find a code example at: components/anchordocking/miniide/miniide1.lpi

msintle

  • Sr. Member
  • ****
  • Posts: 313
Re: Learn how to (un)dock a TPanel
« Reply #23 on: March 06, 2025, 11:33:02 pm »
@msintle, The answer was right in front of me. For the time being I have given up docking but if I need it then this is the starting point:
Quote
https://wiki.freepascal.org/Anchor_Docking#Procedure_to_create_all_other_forms_by_name
and then:
Quote
You will find a code example at: components/anchordocking/miniide/miniide1.lpi

I regret the delay in getting back to you!

Insanely busy here.

Where is that code example at? Which folder is that installed in typically, can you provide an example path please?

msintle

  • Sr. Member
  • ****
  • Posts: 313
Re: Learn how to (un)dock a TPanel
« Reply #24 on: March 11, 2025, 08:15:02 pm »
I regret the delay in getting back to you.

Running this sample with both the latest trunk and our production version of Lazarus (3.4), the behavior is the same:

Trying to dock the horizontally elongated window, there's super odd behavior.

As I approach the dock target form, the window "ghost" suddenly travels back roughly it's own size horizontally.

This happens all the while the cursor is still near my intended dock destination.

From that point onwards everything is very erratic and simply unusable.

Really disappointing to see that we still don't have working docking with Lazarus, even in its own out-of-the-box samples!

Hansvb

  • Hero Member
  • *****
  • Posts: 805
Re: Learn how to (un)dock a TPanel
« Reply #25 on: May 19, 2025, 07:42:28 pm »
Hi msintle,
It took a while but I now have something that works. See the attachment. It is a Form with 1 panel on it. You can drag this panel out of the form. If you let go of the panel when it is completely outside the form, a second form is made on which the panel is placed. The panel must therefore be completely outside form 1. (You can turn it off). You can drag and drop the new form back or close it. In both cases, the panel will be put back on form 1. For me, this is a good starting point to continue tinkering with this.

Hansvb

  • Hero Member
  • *****
  • Posts: 805
Re: Learn how to (un)dock a TPanel
« Reply #26 on: May 21, 2025, 08:16:05 pm »
Another variant.
This is what I actually originally had in mind. If you drag the blue panel, you can release it on the left, right or bottom panel. If you have moved the panel away from the form and not docked, you will get a new form. If you close this, you can make the panel visible again by pressing the button.

There is 1 great concern. If you click on a left, right or bottom panel, you get an AV. This refers to dramanager.inc rule 717. It says: AControl.BeforeDragStart; It seems that this is due to these lines.
Code: Pascal  [Select][+][-]
  1. TopDock.DockSite := True; BottomDock.DockSite := True; LeftDock.DockSite := True; RightDock.DockSite := True;
Even though there is no event linked to the panels, the onclck is still activated.
Does anyone have a tip to prevent that? I tried a tcustom panel provided with an empty mouseclickevent but even then I get the AV.
« Last Edit: May 21, 2025, 09:01:53 pm by Hansvb »

 

TinyPortal © 2005-2018