Skip to main content

Add items to autolayout in component instances

  • September 6, 2023
  • 4 replies
  • 968 views

Mark23

We often have the problem that we don’t know how many items we should include in a component, for example a toolbar. We often end up adding some hidden extra buttons.

This works, but it has some really annoying downsides:

  • We have to guess a good maximum number of items
  • We have to detach if we want to add more
  • We cannot handle separators in a good way, other than adding them everywhere and hiding them
  • It’s way too difficult to reorder items

I suggest that autolayouts can have a property that allows for adding more items of a specified type (with reordering). Then we would be able to make our components much more simple and flexible.

Chris_Ferejohn

Yes, it is baffling that this isn’t possible. I made a component for panels our app uses which allows me and my team to add a correctly sized and formatted panel really easily. That’s great. But that panel has a frame inside it to hold content (which could be any number of checkbox/radio button settings, text, input fields, dropdowns, etc. The only way I can actually use my instance is to detach it from the main component, which pretty much obviates up the whole point of using components in the first place.

Why can’t it just treat everything in the frame like a black box so all it maintains is the frame setting w/o caring about what contents are inside of it?


Dennis_N
  • Power Member
  • December 11, 2023

Really looking forward to something the thread author shared. Would be way more dynamic than what we currently have.
Our team is using the slot method to have at least a bit of flexibility regarding item count but it’s far from perfect as it comes with the already mentioned downsites and limitations. Also: Once slots are filled/swapped with components, you can’t reduce the item count via property dropdown menu and need to hide each element by hand.
See:
slotgroup


tank666
  • December 11, 2023

You need to assemble the component correctly. This is the structure it should be:

Slot group
    Container 1 (visible true or false)
        Slot
    Container 2 (visible true or false)
        Slot

Dennis_N
  • Power Member
  • December 11, 2023

Brilliant! Thanks a lot Yury


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings