Opened 20 months ago

Closed 20 months ago

Last modified 20 months ago

#340 closed enhancement (fixed)

Fixing width of list(tree) to fit longest entry

Reported by: Oliver Roberts Owned by: Thore Böckelmann
Priority: normal Milestone: 5.0-2017R2
Component: List.mui Version: 5.0-nightly build
Severity: minor Keywords:
Cc: OS Platform: AmigaOS4
Blocked By: Blocking:
Release Notes:

Added a new private method to iterate over all list items. In case of Listtree.mcc this method makes it possible to iterate over the invisible/folded and hence not (yet) added tree nodes to calculate their dimensions.

Description

This may already be possible to do in MUI automatically somehow…

In the IBrowse preferences window, it fixes the width of listtree on the left to the width of the longest item (which is "Download Manager" under the "Network" node in English locale). The way it accomplishes this is to set MUIA_List_AdjustWidth to TRUE and to pad the width of all entries in the list with trailing spaces so they all have the same length (it does this in MUIM_Setup of the custom class). It uses _listfont() and TextLength to calculate how many spaces to add to each string. This then forces the width to the correct size. Without padding the strings, it the width of the list is set to the long visible entry, which means it is too narrow on initial opening.

Is there some way to accomplish the same end result without all the messing about with padding strings?

Attachments (4)

Listtree_test.lha (26.3 KB) - added by Thore Böckelmann 20 months ago.
Listtree.mcc with width calculation of all nodes
muimaster_Listtree.lha (415.9 KB) - added by Thore Böckelmann 20 months ago.
muimaster.library and Listtree.mcc test versions
muimaster_Listtree_2.lha (415.2 KB) - added by Thore Böckelmann 20 months ago.
muimaster.library and Listtree.mcc test versions, 2nd try
ibprefs.jpg (53.7 KB) - added by Oliver Roberts 20 months ago.
Screen grab of 2nd try

Download all attachments as: .zip

Change History (14)

Changed 20 months ago by Thore Böckelmann

Attachment: Listtree_test.lha added

Listtree.mcc with width calculation of all nodes

comment:1 Changed 20 months ago by Thore Böckelmann

Please try the attached version of Listtree.mcc without your artificial padding. I hope it fixes this issue. At least my own tests proved that the default width is calculated large enough to show all nodes with full text length.

comment:2 Changed 20 months ago by Oliver Roberts

Hmmm… this doesn't appear to make any difference, at least with MUIA_List_AdjustWidth set to TRUE. With it set to FALSE, there is a difference, but the end result is not what is desired. As far as I can tell, what IBrowse is trying to achieve is a completely fixed width list, but only as wide as the longest entry. So, when you resize the window, etc, the list width never changes, it never has a scrollbar, etc. I can send you the source code to this if you think it would help?

comment:3 Changed 20 months ago by Thore Böckelmann

That would be great!

Changed 20 months ago by Thore Böckelmann

Attachment: muimaster_Listtree.lha added

muimaster.library and Listtree.mcc test versions

comment:4 Changed 20 months ago by Thore Böckelmann

Please try again with the second test archive. You will need to remove the MUIA_List_AdjustWidth attribute to let Listtree class do its work properly.

comment:5 Changed 20 months ago by Oliver Roberts

Seems to behave just like before. On initial open the list is now too wide, and resizing the window causes the listview to change width - it is possible to make the listview not wide enough to show even the shortest entry and it adds a scrollbar.

BTW, I'm open to changing this code in IBrowse if you feel the end effect could be accomplished a different way.

Changed 20 months ago by Thore Böckelmann

Attachment: muimaster_Listtree_2.lha added

muimaster.library and Listtree.mcc test versions, 2nd try

comment:6 Changed 20 months ago by Thore Böckelmann

Ok, another try.

Try this one requires MUIA_List_AdjustWidth again to enforce a fixed width.

Changed 20 months ago by Oliver Roberts

Attachment: ibprefs.jpg added

Screen grab of 2nd try

comment:7 in reply to:  6 Changed 20 months ago by Oliver Roberts

Unfortunately, I don't see any improvement - layout/rendering seems to mess up a lot when resizing window. But, more importantly, it opens with the listview too small, and a big blank area to the right. See ibprefs.jpg attachment for screen grab.

comment:8 Changed 20 months ago by Thore Böckelmann

Can you provide a special build of IBrowse (68k) without the artificial padding, please? Then I can check myself whether my modifications succeed or fail.

Last edited 20 months ago by Thore Böckelmann (previous) (diff)

comment:9 Changed 20 months ago by Thore Böckelmann

Owner: set to Thore Böckelmann
Resolution: fixed
Status: newclosed

In 5813:

  • List.c, mcc/Listtree.c: added a new private method to iterate over all list items. In case of Listtree.mcc this method makes it possible to iterate over the invisible/folded and hence not (yet) added tree nodes to calculate their dimensions. This finally closes #340.

comment:10 Changed 20 months ago by Thore Böckelmann

Milestone: future release5.0-2017R2
Priority: undecidednormal
Release Notes: modified (diff)
Note: See TracTickets for help on using tickets.