Another question, I am trying to create my own cus...
# compose
j
Another question, I am trying to create my own custom title bar for compose. The framework seems determined to not let me, annoying because in C# this was as easy as interfacing with the Win32 library.
a
This isn’t a question but a statement
r
You can use swing API on windows. Android API on Android, iOS Apis on iOS
j
Sorry, to be clear, I was wondering if a crossplatform way existed. I think I found a way to hide the title bar, hopefully it works on linux/mac
m
I’ve just created a custom title bar yesterday (Compose Desktop) and was quite easy. Also tested on Linux and it worked fine.
j
Im having quite a bit of trouble with it ...
Copy code
fun main() = application {
    Window(
        onCloseRequest = ::exitApplication,
        state = ScreenUtils.windowState,
        undecorated = true,
    ) {

        WindowDraggableArea(modifier = Modifier.height(100.dp)) {

                Column(modifier = Modifier.fillMaxWidth()) {
                    Row(
                        modifier = Modifier.fillMaxWidth().fillMaxHeight(0.10f),
                        horizontalArrangement = Arrangement.End,
                        verticalAlignment = <http://Alignment.Top|Alignment.Top>
                    ) {
                        Button(
                            onClick = ::exitApplication,
                            shape = CircleShape,
                            modifier = Modifier.height(15.dp).width(15.dp).padding(end = 2.dp),
                            colors = ButtonDefaults.buttonColors(Color.Red)
                        ) {
                            Text("X")
                        }
                    }


                }


        }
        MainView()

    }
}
this has no draggable area.
m
Your draggable area is covered under your MainView(). You haven’t specified any layout so they are just stacked on top of each other.
j
i still have to do those layout things? oh.... shudders in xml
a
It has nothing to do with XML. If you hate compose so much, why use it?
m
What do you mean by "those layout things"? If you want to put elements in a column, you need to put them in a
Column {}
. It can't read your mind.
j
I dont hate compose at all. There are a few frustrating bits and clear design flaws but I am really enjoying using it and it make me want to actually develop more for android.
Marcin, like XML layouts that you have to make
a
There are no XML layouts
j
Oh I thought thats what marcin meant by a layout. My only experience with layouts is from like android xml
a
How can you be so adamant about “obvious design flaws” if you don’t even grasp the basics?
😄 1
j
Because they are obvious. Not having a layout inspector on desktop is a perfect example.
r
There is nothing stopping you from creating your own layout inspector
j
Please dont with that. Its not helpful and is basically used as a "I dont care for criticism" style response. There is nothing stopping me from making my own framework, or my own OS but you know as well as I do that thats not the point
r
The point is that you are not providing any constructive criticism, you are rather undermining the framework by saying it has obvious design flaws, yet you don't seem to have spent anytime trying to understand the basics of it.
👍 1
j
Funny the only criticism I have stated here is that it has obvious flaws. And I pointed out an obvious flaw to which you have no real response. If something is wrong in my understanding of the flaw, then I am all ears. The framework can be overmined, undermined, blown up in a mining explosion, whatever... it honestly does not matter to me. If I see an obvious flaw, i point out an obvious flaw. Again if there is a workaround or something that mitigates it im all ears but until then, its a flaw
a
Why would you need a layout inspector if you didn’t even knew what layouts were?
j
because the layout inspector lets you see any composable... at least the basic ones like "box" and what not
a
I’ve never needed the layout inspector and I know exactly which composables are there.
j
Its like the react element inspector from what I have seen
a
Ok. So no real experience. Good luck with your endeavors. Maybe read some more docs.
r
😂
j
Yep I am just lowly skrub who uses inspect element shame on me... I think it is obvious that I am new to the framework lol
a
Normally I’d want to be more welcoming and open in this community but it has to go both ways.
If you’re new to the framework, let people help you. You come barging in with a lot of prejudice.
But it must be at least a bit fun to help you
j
Idk i think that Ive let the person actually helping me (Marcin) help me...maybe you people just treat this framework like your baby 🙂 Marcin btw you were right, the solution was to move my main view in the column.
m
Glad it worked. Keep in mind that Compose Desktop is not as mature as Compose on Android, and it's relatively new, so finding issues is not uncommon. The lack of layout inspector is definitely a bummer, but it's not a design flaw - Compose Desktop wasn't designed not to have one, it just doesn't have one yet, and probably will at some point in the future. As an alternative, I sometimes find it useful to temporarily add a
Modifier.border(1.dp, Color.Red)
to a composable, to highlight its bounds at runtime or in a preview.
j
Yeah I tried that but I did not realize that things were literally drawing over each other, thus hiding the background I set. Ill try it with border in the future as that may be a better visual representation ty again for help