Recent

Author Topic: AnchorDocking in my app  (Read 1764 times)

pebe

  • New Member
  • *
  • Posts: 29
AnchorDocking in my app
« on: April 09, 2022, 06:35:41 pm »
I started playing around with AnchorDocking, however, I encountered a somewhat annoying problem.
When I dock a floating window to the main form and use the close button on the docked form, I can no longer dock anything.

I'm using the code from the examples on the Wiki, but the documentation is very poor and doesn't do much to address the above problem.
English is not my language - I use DeepL to translate my thoughts :)

zamtmn

  • Hero Member
  • *****
  • Posts: 667
Re: AnchorDocking in my app
« Reply #1 on: April 09, 2022, 06:40:12 pm »
See components\anchordocking\minide and components\anchordocking\minidewithdockpanel

pebe

  • New Member
  • *
  • Posts: 29
Re: AnchorDocking in my app
« Reply #2 on: April 09, 2022, 08:04:47 pm »
The first difference I noticed is the use of AnchorDockPanel. Also, both examples use the DockMaster.OnCreateControl event.
However, in the first example (minide) after closing the (last) docked window, I also could not add (dock) another window.
For that, the second example (minidedockpanel) works just fine.

I used AnchorDockPanel in my program and... flop. Exactly the same behavior. The last docked window, after closing, blocked the possibility of docking a new window.

Maybe the problem lies in how I manage floating windows?
Because I create each such window while the program is running.
I do it according to the Wiki instructions, ie:
Code: Pascal  [Select][+][-]
  1. DockMaster.MakeDockable(VForm,true,true);
I can also close them - Form.Close method, where CloseAction:=caFree). However, in this case I am not doing anything else. Or should I? For example, check if this is the last visible window and if it is, reallocate main window to DockMaster using
Code: Pascal  [Select][+][-]
  1. DockMaster.MakeDockable(MainForm);

 :-\
English is not my language - I use DeepL to translate my thoughts :)

pebe

  • New Member
  • *
  • Posts: 29
Re: AnchorDocking in my app
« Reply #3 on: April 11, 2022, 08:15:25 pm »
Maybe another time I'll figure out what is causing the DockMaster to "disappear" if the last docked window is closed.

Meanwhile, I have another question for the experts.

Is there a SIMPLE way to remove the docked form closing control?
« Last Edit: April 11, 2022, 08:19:18 pm by pebe »
English is not my language - I use DeepL to translate my thoughts :)

zamtmn

  • Hero Member
  • *****
  • Posts: 667
Re: AnchorDocking in my app
« Reply #4 on: April 11, 2022, 08:44:08 pm »
I didn't understand your problem. please give a minimal example

pebe

  • New Member
  • *
  • Posts: 29
Re: AnchorDocking in my app
« Reply #5 on: April 11, 2022, 10:10:55 pm »
I hasten to explain.
Watch the film. It presents my problem. Switch on the subtitles!

I apologize in advance for the poorly done subtitles - I was in a hurry to reply :)

https://youtu.be/7H9Ycf8xE2Q

What's going on?
Why is this happening?
And how to prevent it?

:)
« Last Edit: April 11, 2022, 10:40:51 pm by pebe »
English is not my language - I use DeepL to translate my thoughts :)

andrew_arprix

  • Newbie
  • Posts: 3
Re: AnchorDocking in my app
« Reply #6 on: May 24, 2025, 04:44:54 pm »
Lazarus 4 has been released, and can be even use AnchorDocking in the IDE now. But the problems still remain.
Even Lazarus was stuck when dragging windows. It's sad. Experts tell me where to intercept the moment of destruction of the DockMaster. There may be another reason, but after closing the last docked window, the DockMaster seems to die.

Fred vS

  • Hero Member
  • *****
  • Posts: 3622
    • StrumPract is the musicians best friend
Re: AnchorDocking in my app
« Reply #7 on: May 24, 2025, 04:50:30 pm »
For Docking Forms, the King is MSEgui, it has docking form feature by design.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

andrew_arprix

  • Newbie
  • Posts: 3
Re: AnchorDocking in my app
« Reply #8 on: May 24, 2025, 09:32:29 pm »
Unfortunately, I can't use other libraries, I have a large project and the transition is not possible, besides, I need the ability to run in MACOS.
I want to ask the developers: Do I understand correctly that the 2018 AnchorDocking library was taken as an alternative to the interface of the new Lazarus, and so far no one has encountered an obvious bug when it stops working when the last docket window is closed?

andrew_arprix

  • Newbie
  • Posts: 3
Re: AnchorDocking in my app
« Reply #9 on: May 24, 2025, 10:29:58 pm »
I found some solution, but it only works if you do DockMaster.Make DockPanel(Anchor DockPanel1,admrpChild); not the form. However, a small modification is needed in AnchorDocking.pas. Just add a line "HeaderParent.Undock();"  в TAnchorDockHeader.CloseButtonClick(Sender: TObject);

Code: Pascal  [Select][+][-]
  1. procedure TAnchorDockHeader.CloseButtonClick(Sender: TObject);
  2. var
  3.   HeaderParent:TAnchorDockHostSite;
  4. begin
  5.   TWinControl(HeaderParent):=Parent;
  6.   if HeaderParent=TWinControl(DockMaster.FOverlappingForm) then begin
  7.     HeaderParent:=DockMaster.FOverlappingForm.AnchorDockHostSite;
  8.     HeaderParent.HideMinimizedControl;
  9.   end;
  10.   if HeaderParent is TAnchorDockHostSite then begin
  11.     DockMaster.RestoreLayouts.Add(DockMaster.CreateRestoreLayout(HeaderParent),true);
  12.     HeaderParent.Undock(); <---
  13.     HeaderParent.CloseSite;
  14.   end;
  15. end;  
  16.  


Fred vS

  • Hero Member
  • *****
  • Posts: 3622
    • StrumPract is the musicians best friend
Re: AnchorDocking in my app
« Reply #10 on: May 24, 2025, 10:32:31 pm »
Unfortunately, I can't use other libraries, I have a large project and the transition is not possible, besides, I need the ability to run in MACOS.

OK, I understand (but MSEgui apps can run on MacOS).
« Last Edit: May 24, 2025, 10:41:03 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

zamtmn

  • Hero Member
  • *****
  • Posts: 667
Re: AnchorDocking in my app
« Reply #11 on: May 25, 2025, 02:18:42 pm »
I use AnchorDocking on Windows and Linux (in Lazarus, and my own app. but I don't have MACOS), I don't see any problems with closing.

 

TinyPortal © 2005-2018