[Lazarus] TMenu(Item) AutoLineReduction: help needed from Delphi users/owners

Bart bartjunk64 at gmail.com
Thu Sep 12 12:27:09 CEST 2024


Hi,

We've recently implemented the AutoLineReduction property for TMenu(Item).
The current implementation is based upon the Delphi docs and some limited
user input.
So, questions remain.

For those who have a recent Delphi installed, can you please try to answer
these 2 questions (I have D7, which is, to be mild, a bit ancient).

Question 1.

Given the following Menu:
TopLevel
- ItemA
- Separator
- ItemB
- Separator
- ItemC

Given that TopLevelA.GetAutoLineRedction will return True.

Now I do: ItemB.Visible := False
Then I do: TopLevel.RethinkLines.

This will hide one of the 2 now consective separators (in our
implementation it hides the second one).
So it will show as
TopLevel
- ItemA
- Separator
- ItemC

I suppose this is how Delphi works as well.

So far, so good.

Now I do: ItemB.Visible := True
Then I do: TopLevel.RethinkLines.

I implemented RethinkLines such that it will now restore the separator
after ItemB, because this makes sense to me.
But I have absolutely no idea if Delphi does this as well.

Question 2

Given the following Menu:
TopLevel
- Separator
- ItemA
- Separator
- Separator
- ItemB
- Separator
- Separator
- ItemC
- Separator

And TopLevel.AutoLineReduction starts out as maManual, so all separators
are visible.

Now I do: TopLevel.AutoLineReduction := maAutomatic
Then I do: TopLevel.RethinkLines

It will now show as:
- ItemA
- Separator
- ItemB
- Separator
- ItemC

This is Delphi compatible AFAIK.

Now I do: TopLevel.AutoLineReduction := maManual
Then I do: TopLevel.RethinkLines

I implemented RethinkLines so that this will set all separators Visble
property to True again.
This makes sense to me, as it performs the opposite action of maAutomatic.
But again, I'm not really sure this is what Delphi does in this case.

So, your (Delphi users/owners) help is appreciated.

Thanks in advance.

-- 
Bart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20240912/b951178f/attachment.htm>


More information about the lazarus mailing list