Recent

Author Topic: Using AnchorDocking and avoid resizing  (Read 5045 times)

bastynator

  • New Member
  • *
  • Posts: 16
Using AnchorDocking and avoid resizing
« on: July 03, 2016, 09:01:22 pm »
Hey, i am using AnchorDocking for an application and it looks quite cool.

But now i have the problem, that AnchorDocking ignores the constrains of the main form.
The 'minide' example also has this problem
(/usr/share/lazarus/1.6/components/anchordocking/minide)

The user can resize the top-toolbar, i attached a screenshot to illustrate the behavior i want to avoid.

In lazarus itself, you can't resize the toolbar (that's what i want), so it must be possible to avoid this.
Has anybody an idea to do so?

bastynator

  • New Member
  • *
  • Posts: 16
Re: Using AnchorDocking and avoid resizing
« Reply #1 on: December 19, 2017, 09:32:03 am »
I found a way how to avoid this resizing.
I create an own splitter-class (DockMaster.SplitterClass := TMySplitter). Then i override the protected method SetParent, see below. I set a check-function whether splitter-movement is allowed and i set the visibility for the splitter.
I allow resizing for all anchor-dock-host-sites but not for the main application since this would resize the toolbar.

Code: Pascal  [Select][+][-]
  1. procedure TMySplitter.SetParent(NewParent: TWinControl);
  2. begin
  3.   inherited SetParent(NewParent);
  4.   OnCanResize := MyOnCanResize;
  5.   Visible := NewParent is TAnchorDockHostSite;
  6. end;    
  7.  
  8. procedure TMySplitter.MyOnCanResize(Sender: TObject; var NewSize: Integer;
  9.   var Accept: Boolean);
  10. begin
  11.   Accept := Parent is TAnchorDockHostSite;
  12. end;
  13.  
« Last Edit: December 19, 2017, 09:40:24 am by bastynator »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Using AnchorDocking and avoid resizing
« Reply #2 on: December 19, 2017, 10:46:33 am »
(/usr/share/lazarus/1.6/components/anchordocking/minide)
Use Lazarus 1.8. AnchorDocking has improved there.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

bastynator

  • New Member
  • *
  • Posts: 16
Re: Using AnchorDocking and avoid resizing
« Reply #3 on: March 08, 2018, 03:04:38 pm »
@JuhaManninen
Ah ok, i did not find the improvement in this case. Can you point me to the right position to use the improvement?

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Using AnchorDocking and avoid resizing
« Reply #4 on: March 08, 2018, 06:10:22 pm »
Ah ok, i did not find the improvement in this case. Can you point me to the right position to use the improvement?
Ok, maybe there are no improvements for this particular issue. However there are many bug fixes and a new example called minidewithdockpanel. It is from Andrey Zubarev who uses AnchorDocking in his own project and fixed many bugs while testing it.
Your splitter solution looks good and simple. The solution used by Lazarus can be found in unit MainBar, procedure TMainIDEBar.DoSetMainIDEHeight(). It is more complex.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018