https://kotlinlang.org logo
#compose-desktop
Title
# compose-desktop
n

natpryce

01/25/2023, 12:28 AM
What’s the equivalent of Swing’s GridBagLayout in Jetpack Compose Desktop? In particular I want columns to be sized to fit components in that column.
k

Kirill Grouchnikov

01/25/2023, 12:35 AM
I hope none 🙂 Totally
I wouldn’t mind if somebody brings something a bit more modern like FormLayout or MigLayout over

https://www.youtube.com/watch?v=UuLaxbFKAcc

n

natpryce

01/25/2023, 7:08 AM
I don’t care about the precise class :-) However, I’m surprised by how hard it is to layout my components in a grid. All example code I’ve found involves either hard-coding the sizes of the columns or calculating the size myself.
o

orangy

01/25/2023, 9:02 PM
I recently implemented a simple Table component, like, in few hours, and most time spent drawing lines between cells and properly measuring them, depending on the line width and such 🙂 Unfortunately, I didn’t yet open source it, because I don’t have proper context to do it. Considering contributing to https://github.com/JetBrains/compose-jb/tree/master/components, or maybe starting own project with components – I have some useful stuff to share
Usage would be something like this:
Copy code
Table(…) {
   row {
     cell { … }
     cell { … }
   }
   row {
     cell { … }
     cell { … }
   }
}
n

natpryce

01/27/2023, 9:26 AM
The design of the existing LazyVerticalGrid almost makes this possible, but the grid does not pass the content items to the strategy that computes the column sizes.
So close, yet so far 🙁
o

orangy

01/27/2023, 11:47 AM
My table is not lazy at all, because, how would you do it?
n

natpryce

01/28/2023, 10:42 AM
That is a v good point
17 Views