Feature request: ListView column widths as percentage

Discuss GUI programming with the RapaGUI plugin here
Post Reply
User avatar
mrupp
Posts: 147
Joined: Sun Jan 31, 2021 7:44 pm
Location: Switzerland
Contact:

Feature request: ListView column widths as percentage

Post by mrupp »

It would be very very nice if column widths in a ListView could be defined as percentage of the ListView's width. Imho, this would fit the overall philosophy of RapaGUI's resizeability most perfectly.

Cheers,
Michael
SamuraiCrow
Posts: 475
Joined: Fri May 15, 2015 5:15 pm
Location: Waterville, Minnesota USA

Re: Feature request: ListView column widths as percentage

Post by SamuraiCrow »

Using proportions allows this to be done without changing the plugin at all. The width of the listview can be obtained from the getter visibility of the area parent class width and then setting the listview column widths proportionately. Doing it manually is better in some cases because a floating point multiply is a single operation on most platforms nowadays. Even if integer math is used, fixed point based on a power of 2 is almost always faster than decimal arithmetic dividing by 100.
I'm on registered MorphOS using FlowStudio.
User avatar
mrupp
Posts: 147
Joined: Sun Jan 31, 2021 7:44 pm
Location: Switzerland
Contact:

Re: Feature request: ListView column widths as percentage

Post by mrupp »

Thank you for your answer. A view more questions though (sorry if they seem silly, I'm still a bit of a newbie):
  • What do you mean by "proportions"? That's not some column property to set, is it?
  • How can I detect a change of the Listview's width (if the window is horizontally resized, for example)?
  • To set the width of the colums correctly, I would need to know if the Listview shows a vertical scrollbar or not, to substract its width from the Listview's total width. How can I check if there's a v scrollbar and how do I get its width (which will most likely differ on every platform)?
I still get the impression that it would be much more comfortable to be able to set column widths by percentage (or weight, like it's done with groups).
SamuraiCrow
Posts: 475
Joined: Fri May 15, 2015 5:15 pm
Location: Waterville, Minnesota USA

Re: Feature request: ListView column widths as percentage

Post by SamuraiCrow »

mrupp wrote: Fri Feb 19, 2021 8:17 pm Thank you for your answer. A view more questions though (sorry if they seem silly, I'm still a bit of a newbie):
  • What do you mean by "proportions"? That's not some column property to set, is it?
Instead of writing it as 33% multiply the gadget width by .33 for example, and set the column width using

Code: Select all

moai.Set(id, "Width", gadwid*.33)
mrupp wrote: Fri Feb 19, 2021 8:17 pm
  • How can I detect a change of the Listview's width (if the window is horizontally resized, for example)?
This one's a little trickier but there is a gadget refresh notification for the Hollywood gadget so a single-pixel high transparent Hollywood gadget in the Listview's VGroup with the Area.FixWidth attribute set to false will give you the information you need.
mrupp wrote: Fri Feb 19, 2021 8:17 pm
  • To set the width of the colums correctly, I would need to know if the Listview shows a vertical scrollbar or not, to substract its width from the Listview's total width. How can I check if there's a v scrollbar and how do I get its width (which will most likely differ on every platform)?
This one is not possible with current versions of RapaGUI. The closest I can figure is to make one of the columns a little wider than needed and leave its pixel-width unset so it will "absorb" the width from the slider.
mrupp wrote: Fri Feb 19, 2021 8:17 pm I still get the impression that it would be much more comfortable to be able to set column widths by percentage (or weight, like it's done with groups).
I'd prefer the column weight since it defaults to 100 anyway but can use powers of two if needed.
I'm on registered MorphOS using FlowStudio.
User avatar
mrupp
Posts: 147
Joined: Sun Jan 31, 2021 7:44 pm
Location: Switzerland
Contact:

Re: Feature request: ListView column widths as percentage

Post by mrupp »

@Andreas: What do you think of having "weight" on listview columns (or "width" in percentage)? Imho, this would allow much nicer looking and adapting grids.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Feature request: ListView column widths as percentage

Post by airsoftsoftwair »

mrupp wrote: Tue May 25, 2021 6:26 pm @Andreas: What do you think of having "weight" on listview columns (or "width" in percentage)? Imho, this would allow much nicer looking and adapting grids.
Sorry, not very likely to come. The listview widget has 8 (!) different backends and this would have to be implemented for all of them. wxWidgets doesn't support it so I'd first have to extend wxWidgets to support it and it's not an easy task because of the many different backends involved. That's just not worth the effort. Maybe file a feature request with the wxWidgets team, then I could add support for it :)
Post Reply