Recent

Author Topic: Does anyone know how to fix the WMSize loop bug in "AnchorDocking Design"?  (Read 10496 times)

Akira1364

  • Hero Member
  • *****
  • Posts: 563
It's rather annoying having to click through ten or so error message boxes every time I open Lazarus...

balazsszekely

  • Guest
1. Hide the component palette(Tools-->Options-->Component Palette-->Uncheck Palette is visible
2. Use the Component Window instead(Ctr+Alt+P  or  View-->Components). You can dock it if you like.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4597
  • I like bugs.
Is it related to this issue?
 http://bugs.freepascal.org/view.php?id=28096
I just added a comment there. Most people including me don't get any errors. I have the Component Palette visible.
How to reproduce? Does it happen with a clean configuration? Does it happen only on Windows?
Clear steps to reproduce please.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

balazsszekely

  • Guest
Quote
@JuhaManninen
Most people including me don't get any errors.
Because this issue is not present under GTK2, but it did happened to you too on QT, in fact you where the first one who noticed.  :)
Please read this: http://forum.lazarus.freepascal.org/index.php/topic,30663.msg196033.html#msg196033

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4597
  • I like bugs.
Because this issue is not present under GTK2, but it did happened to you too on QT, in fact you where the first one who noticed.  :)
Please read this: http://forum.lazarus.freepascal.org/index.php/topic,30663.msg196033.html#msg196033

I don't get such errors with any widgetset. I though the bugs were fixed already. Maybe not. Are you sure you use the latest RC2 version (or trunk)?
Akira1364, you did not mention your Lazarus version nor your widgetset.

[Edit] Actually I get some errors with the Windows version after playing with docking for a while.
« Last Edit: January 16, 2016, 06:24:22 pm by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Akira1364

  • Hero Member
  • *****
  • Posts: 563
I'm on 64-Bit Windows (so the "win32" widgetset), and I always use either the latest official release of Lazarus or a build of the latest trunk. Specifically, the error seems to happen when you re-open the IDE after closing it while the window is fully maximized (which is essentially always for me, and I imagine many other people.) It's been a consistently present bug in every possible iteration of the AnchorDocking Design package and the IDE itself going back presumably forever (as I don't remember it ever NOT being there.)

[Edit]: Also, yes, it appears to be the same bug that is described in the bugtracker page that was linked to. It's worth noting as well that it does not exist/occur in CodeTyphon's IDE GlassDocking package, which is clearly based directly on AnchorDocking Design...
« Last Edit: January 16, 2016, 08:13:28 pm by Akira1364 »

balazsszekely

  • Guest
@Juha
Please take a look at this: http://bugs.freepascal.org/view.php?id=28063

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4597
  • I like bugs.
It's worth noting as well that it does not exist/occur in CodeTyphon's IDE GlassDocking package, which is clearly based directly on AnchorDocking Design...

GlassDocking is apparently doing something better. I once went through its code to find differences for AnchorDocking, using an advanced diff tool. It was quite a laborious task because they had run the code through JCF or other similar code formatter.
The only relevant difference was an extra dock-master window CodeTyphon had added. I did not fully understand it purpose but very likely it fixes this bug.

Somebody should analyse the code and maybe port their solution to AnchorDocking. Hey, this is open source! Let's take all the fun out of it.
My own motivation, time and energy are not enough for an AnchorDocking task. I have a long list of other tasks.
Now the situation of AnchorDocking is strange. Many people apparently want to use it but very few want to contribute for it. Why is that?

Quote
Please take a look at this: http://bugs.freepascal.org/view.php?id=28063

@GetMem, that was a different issue at least when I reported it, but maybe they are caused by the same fundamental reason. Don't know.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Akira1364

  • Hero Member
  • *****
  • Posts: 563
Ok, I've figured out exactly how CodeTyphon fixed this bug. It seems that what they're doing differently that corrects the error isn't in the GlassDocking code, but in the code for the IDE itself. More specifically, in the file mainbar.pas they've changed the procedure "TMainIDEBar.DoSetMainIDEHeight" to consist of a single line:

Code: Pascal  [Select][+][-]
  1. procedure TMainIDEBar.DoSetMainIDEHeight(const AIDEIsMaximized: Boolean; ANewHeight: Integer);
  2. begin
  3.   if ANewHeight < 25 then ANewHeight := 25;
  4. end;

I copy and pasted this implementation of the procedure into the Lazarus version of mainbar.pas, rebuilt the IDE, and the bug seems to be completely gone. I even spent about half an hour going out of my way to set up weird docking layouts and then closing and re-opening the IDE, and it has never recurred.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Ok, I've figured out exactly how CodeTyphon fixed this bug. It seems that what they're doing differently that corrects the error isn't in the GlassDocking code, but in the code for the IDE itself. More specifically, in the file mainbar.pas they've changed the procedure "TMainIDEBar.DoSetMainIDEHeight" to consist of a single line:

Code: Pascal  [Select][+][-]
  1. procedure TMainIDEBar.DoSetMainIDEHeight(const AIDEIsMaximized: Boolean; ANewHeight: Integer);
  2. begin
  3.   if ANewHeight < 25 then ANewHeight := 25;
  4. end;

I copy and pasted this implementation of the procedure into the Lazarus version of mainbar.pas, rebuilt the IDE, and the bug seems to be completely gone. I even spent about half an hour going out of my way to set up weird docking layouts and then closing and re-opening the IDE, and it has never recurred.
which is not a solution just a cover up of the real problem. It is though a temporary solution to the problem until a someone rewrites the mess of resize on the main controls.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Akira1364

  • Hero Member
  • *****
  • Posts: 563
Re: Does anyone know how to fix the WMSize loop bug in "AnchorDocking Design"?
« Reply #10 on: January 18, 2016, 01:49:16 am »
That might be true, but as it has no negative repercussions on any aspect of the IDE's functionality, and fixes a problem that's been a nuisance for years, it's good enough for me!

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Does anyone know how to fix the WMSize loop bug in "AnchorDocking Design"?
« Reply #11 on: January 18, 2016, 02:08:22 am »
That might be true, but as it has no negative repercussions on any aspect of the IDE's functionality, and fixes a problem that's been a nuisance for years, it's good enough for me!
for me is uninteresting I do not use the component palette any more nor the docking interface at all but the underline problem is something that I see very often in my components and it is bad enough to have me thinking of forking lcl and disabling it all together. They have coded it in a way that it can not be disabled in any components and I do not think a patch that disables the inferno loop is going to be accepted by the team.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

balazsszekely

  • Guest
Re: Does anyone know how to fix the WMSize loop bug in "AnchorDocking Design"?
« Reply #12 on: January 18, 2016, 07:05:30 am »
Quote
@Akira1364
Ok, I've figured out exactly how CodeTyphon fixed this bug. It seems that what they're doing differently that corrects the error isn't in the GlassDocking code, but in the code for the IDE itself. More specifically, in the file mainbar.pas they've changed the procedure "TMainIDEBar.DoSetMainIDEHeight" to consist of a single line
That's great! I was aware that CalcMainIDEHeight causing the trouble(see my post here: http://forum.lazarus.freepascal.org/index.php/topic,30663.msg196033.html#msg196033). Please attach a patch to the following bug report: http://bugs.freepascal.org/view.php?id=28096 , so finally we can get rid of this ugly bug.
Ps: This is why I don't consider CT as evil as other people do, although I have to admit they should leave the license info intact.

Quote
@taazz
for me is uninteresting I do not use the component palette any more nor the docking interface at all but the underline problem is something that I see very often in my components and it is bad enough to have me thinking of forking lcl and disabling it all together. They have coded it in a way that it can not be disabled in any components and I do not think a patch that disables the inferno loop is going to be accepted by the team.
This particular issue is caused by a bug in TScrollBox(I will search it in the bug tracker) and I'm almost 100% convinced that @Akira1364's patch will be accepted as a temporary solution.
« Last Edit: January 18, 2016, 07:21:27 am by GetMem »

Deepaak

  • Sr. Member
  • ****
  • Posts: 454
Re: Does anyone know how to fix the WMSize loop bug in "AnchorDocking Design"?
« Reply #13 on: January 18, 2016, 10:42:34 am »
@Akira1364
solution is working perfectly. no more dialog mess. I too feel this solution must be accepted as a temporary solution, till something perfect comes out to save us.
Holiday season is online now. :-)

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4597
  • I like bugs.
Re: Does anyone know how to fix the WMSize loop bug in "AnchorDocking Design"?
« Reply #14 on: January 18, 2016, 01:12:16 pm »
Ok, I've figured out exactly how CodeTyphon fixed this bug. It seems that what they're doing differently that corrects the error isn't in the GlassDocking code, but in the code for the IDE itself. More specifically, in the file mainbar.pas they've changed the procedure "TMainIDEBar.DoSetMainIDEHeight" to consist of a single line:

Code: Pascal  [Select][+][-]
  1. procedure TMainIDEBar.DoSetMainIDEHeight(const AIDEIsMaximized: Boolean; ANewHeight: Integer);
  2. begin
  3.   if ANewHeight < 25 then ANewHeight := 25;
  4. end;

I copy and pasted this implementation of the procedure into the Lazarus version of mainbar.pas, rebuilt the IDE, and the bug seems to be completely gone. I even spent about half an hour going out of my way to set up weird docking layouts and then closing and re-opening the IDE, and it has never recurred.

The method makes no sense. It is essentially a no-op as ANewHeight is not a var parameter. Why not make an empty method instead?

I wanted to make tests with the code but for some reason I cannot reproduce the bug now. I am testing under Wine, maybe that has an effect.
So, I must analyse the code instead ...
The essential part of method  TMainIDEBar.DoSetMainIDEHeight is this:
Code: Pascal  [Select][+][-]
  1.   if Assigned(IDEDockMaster) then
  2.   begin
  3.     if EnvironmentOptions.Desktop.AutoAdjustIDEHeight then
  4.       IDEDockMaster.AdjustMainIDEWindowHeight(Self, True, ANewHeight)
  5.     else
  6.       IDEDockMaster.AdjustMainIDEWindowHeight(Self, False, 0);
  7.   end else
  8.   ...

The "else" part is for non-docked IDE and does not matter here.
If you turn off the "Automatically adjust IDE main window height" option, does it solve the problem?
If it does then it can be used as a workaround instead of changing code.
If not, then the problem must be in TIDEAnchorDockMaster.AdjustMainIDEWindowHeight.
I believe the exact error can be spotted by eliminating pieces of code and debugging.
I leave it to somebody who actually can reproduce the error. Anyway, looks like we a near solving this properly. Cool!

[Edit]
If the no-op (empty) DoSetMainIDEHeight solved the problem for a docked IDE, then the calls to IDEDockMaster.AdjustMainIDEWindowHeight can be removed and TIDEAnchorDockMaster.AdjustMainIDEWindowHeight, too, because it is not called from anywhere else.
Is this correct?
« Last Edit: January 18, 2016, 01:39:59 pm by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018