https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
compose-desktop
  • a

    Alejandro Rios

    12/11/2020, 2:43 PM
    Hello, this might be a noob question, from what i've seen about compose is that uses
    Skia
    or
    Skiko
    to render UI, does anyone have an article that explains what is and how it works? just to learn about it, Thanks!
    s
    o
    r
    • 4
    • 8
  • j

    Javier

    12/11/2020, 4:50 PM
    Why AGP 4.1.1 can’t be used in IntelliJ? It was released a few months ago
    s
    s
    • 3
    • 6
  • r

    Ruckus

    12/11/2020, 8:19 PM
    This may be more of an IntellJ question than a compose question, but for some reason lately I see this message all over in compose code:
    Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option
    But I have it set in my gradle
    tasks.withType<KotlinCompile> {
        kotlinOptions {
            jvmTarget = "15"
            useIR = true
        }
    }
    And in my project settings, so I'm not sure what would be causing that. Any ideas? The code compiles and runs fine. The error is only in the IDE.
    t
    a
    • 3
    • 13
  • k

    Kyant

    12/11/2020, 11:07 PM
    How can I use Kotlin 1.4.21? `e: This version (1.0.0-alpha09) of the Compose Compiler requires Kotlin version 1.4.20 but you appear to be using Kotlin version 1.4.21 which is not known to be compatible. Please fix your configuration (or
    suppressKotlinVersionCompatibilityCheck
    but don't say I didn't warn you!).`
    z
    j
    +2
    • 5
    • 12
  • k

    Kirill Grouchnikov

    12/13/2020, 2:25 AM
    Now in Aurora - support for undecorated mode with custom title pane and minimize/restore/maximize/close buttons
    🎉 6
    s
    t
    • 3
    • 20
  • x

    xetra11

    12/16/2020, 11:22 PM
    Is there a nifty way to hook component sizes with teh window size without using window.events.onResize and a mutable state of window size?
    d
    g
    • 3
    • 3
  • c

    Casey Brooks

    12/17/2020, 4:43 PM
    Is there any way to handle right-click events?
    Modifier.clickable()
    has a long-click event (which doesn’t seem to do anything on desktop) but not a right-click
    🤔 2
    i
    b
    +3
    • 6
    • 6
  • m

    Michał Kalinowski

    12/18/2020, 8:22 AM
    Hey, there is any plan for future to support ConstraintLayout 🙂? Or is it supported?
    o
    j
    j
    • 4
    • 3
  • x

    xetra11

    12/18/2020, 12:59 PM
    How to properly close a
    Dialog
    ? I have this logic on a close button inside the Dialog composition
    onClick = { }
    but when I click it the following exception comes up:
    Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Anchor refers to a group that was removed
    Also tried to mutate a
    toggleDialog
    variable to "hide" the dialog but the same problem occurs
    o
    • 2
    • 2
  • t

    Thomas

    12/18/2020, 1:19 PM
    Currently AlertDialog seems to inherit a globally set menubar (which might not be what we want :-)). So, please, where to best file a request for enhancement? Working demo here: https://gist.github.com/tkuenneth/456853d36ae31ff9f2cf9ead1cd87e70
    o
    • 2
    • 2
  • m

    Michael Paus

    12/18/2020, 3:22 PM
    The Android canvas has a method
    drawBitmapMesh
    . I can’t find this, or any equivalent method, in the Compose canvas, so that I could use that on desktop too. I have to render my images distorted, so that I can accommodate to different projections of my map-tiles.
    n
    i
    • 3
    • 4
  • x

    xetra11

    12/19/2020, 12:22 AM
    I tried to use
    gradle packageMsi
    in my GitHub Action pipeline. Unfortunately I fail with this error:
    * What went wrong:
    Execution failed for task ':packageMsi'.
    > Process 'command 'C:\hostedtoolcache\windows\jdk\14.0.2\x64\bin\jpackage.exe'' finished with non-zero exit value 1
    I used this
    runs-on
    OS:
    Virtual Environment
      Environment: windows-2019
      Version: 20201210.0
    d
    t
    • 3
    • 16
  • x

    xetra11

    12/19/2020, 3:22 PM
    Anybody having problems using
    packageDeb
    when having a
    v
    prefix in the version name? https://github.com/JetBrains/compose-jb/issues/205
    m
    • 2
    • 3
  • p

    Peter

    12/21/2020, 3:32 PM
    Liking the approach and api of compose. But wondering, is compose-desktop primary goal to run multi-platform applications also on the desktop, or also to create complex graphical apps that wouldn't make much sense on mobile. So will it be in its final form also a contender for swing and javafx?
    o
    c
    • 3
    • 3
  • d

    Dario Valdespino

    12/21/2020, 3:36 PM
    Will Compose Desktop be available for Kotlin/Native at some point? I mean, Skia is a native library, why stay in the JVM?
    ➕ 2
    c
    o
    s
    • 4
    • 5
  • p

    Paul Woitaschek

    12/21/2020, 11:18 PM
    Thank you compose team! I didn't laugh that much while developing for a while now 😂 And yes, I just finished Queens Gambit on Netflix 🙈
    :kotlin-intensifies: 1
    👏🏼 9
    🔥 5
    i
    b
    +5
    • 8
    • 25
  • p

    Paul Woitaschek

    12/22/2020, 4:18 PM
    In the chess game I wrote above I have the issue that when I drag the chess figures they are drawn below the chess tiles when I move them either right or to the bottom (only while dragging). Is it possible that these issues come from the desktop port? Is desktop compose using something different under the hood and to debug such things should I run it on android? Or do they share such fundamentals and its more likely either a usage error or an upstream compose bug?
    i
    a
    • 3
    • 9
  • j

    Javier

    12/22/2020, 7:12 PM
    When desktop and Android compose will sync their version? I remember it was planned
    ➕ 5
    j
    • 2
    • 5
  • k

    Kirill Grouchnikov

    12/23/2020, 4:15 PM
    Are `ViewModel`s a thing in Compose Desktop world? Or are we using https://github.com/arkivanov/Decompose for something simple like an observable list of data items?
    j
    a
    +2
    • 5
    • 7
  • c

    caelum19

    12/24/2020, 9:35 PM
    Is it possible / an example anywhere of using Compose-desktop for part of the interface for an IntelliJ Plugin?
    x
    m
    k
    • 4
    • 5
  • l

    Lilly

    12/24/2020, 10:59 PM
    Hi, the latest IntelliJ comes with a Jetbrains Runtime in version 11 but I see people using OpenJDK 14. Should we go with JBR or OpenJDK?
    o
    • 2
    • 1
  • x

    xetra11

    12/25/2020, 7:37 PM
    Can you enable Github Discussions here: https://github.com/JetBrains/compose-jb so one is able to post more detailed questions (with screenshots, code examples, etc.)
    ✅ 1
    o
    • 2
    • 1
  • x

    xetra11

    12/25/2020, 8:01 PM
    I fail to open a @Composable function inside the MenuItem
    onClick
    function. Please see the snippet:
    fun main() {
        initializeApp()
        loadProject()
    
        Window(
            title = "CK3 Mod Workbench",
            menuBar = MenuBar(
                Menu(
                    "File",
                    MenuItem(
                        "Open Project",
                        onClick = { loadProjectFile(AppWindowAmbient.current!!) }
                    ),
                    MenuItem("Exit", onClick = { AppManager.exit() })
                ),
    ...
    And here is the
    loadProjectFile(appWindow: AppWindow)
    function:
    private fun loadProjectFile(appWindow: AppWindow) {
        val file = File("")
    
        val fileChooser = JFileChooser()
        fileChooser.addChoosableFileFilter(ProjectFileFilter())
    
        when (fileChooser.showOpenDialog(appWindow.window)) {
            APPROVE_OPTION -> {
                val projectManager = ProjectManager()
                val projectFile = fileChooser.selectedFile
                val projectFromFile = Json.decodeFromString<Project>(projectFile.readText())
                projectManager.loadProject(projectFromFile)
            }
            CANCEL_OPTION -> {
                NotificationsService.warn("Cancel project file opening")
            }
        }
    }
    And I receive the classical compose error message here:
    e: /home/xetra11/Development/projects/app/src/main/kotlin/main.kt: (55, 66): @Composable invocations can only happen from the context of a @Composable function
    What I do not understand is why it's saying I do a
    @Composable
    invocation?
    onClick
    seems to have nothing to do with it as far as I can see since @Composable stuff starts at the Window.content property/lambda. Anyway I attached
    @Composable
    to the
    loadProjectFile
    fun but the error still exists. I feel like I still do not fully understand the concept
    d
    • 2
    • 5
  • x

    xetra11

    12/25/2020, 9:41 PM
    Given this Minimum Reproducable Example:
    fun main() {
        Window(title = "CK3 Mod Workbench") {
            MaterialTheme() {
                val currentDialog = remember { mutableStateOf("noDialog") }
    
                if (currentDialog.value == "characterDialog") Dialog(
                    onDismissRequest = { currentDialog.value = "noDialog" }
                ) {
                    Button(onClick = { currentDialog.value = "noDialog" }) {
                        Text("Close Dialog")
                    }
                }
                Button(onClick = { currentDialog.value = "characterDialog" }
                ) { Text("Open Dialog") }
            }
        }
    }
    I always end up with this exception preventing the dialog from being reopened:
    Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Anchor refers to a group that was removed
    Any idea what is going wrong here? I tried so many things but I just do not understand the problem.
    k
    d
    i
    • 4
    • 6
  • o

    orangy

    12/25/2020, 10:56 PM
    How do I disable GPU on my dual-video macBook? When developing, it’s so annoying when mac goes to switch video card…
    r
    b
    • 3
    • 6
  • o

    orangy

    12/26/2020, 4:29 PM
    I suspect Android doesn’t need a tooltip, but in desktop it is very important. I couldn’t find one for desktop, how would I implement it? I think it should be a modifier, something like
    Modifier.tooltip("Text")
    for simple cases and then
    Modifier.tooltip { … }
    with Slot API for custom tooltips.
    👍 4
    a
    d
    • 3
    • 5
  • o

    orangy

    12/26/2020, 4:35 PM
    Is there a way for
    ScrollableColumn
    to show actual scroll bars, according to system settings? E.g. autohide on mac, etc.
    d
    i
    • 3
    • 6
  • s

    suresh

    12/26/2020, 9:20 PM
    > Task :VideoPlayer:common:compileKotlinDesktop FAILED
    e: java.lang.NoClassDefFoundError: Could not initialize class org.jetbrains.kotlin.com.intellij.pom.java.LanguageLevel
            at org.jetbrains.kotlin.com.intellij.core.CoreLanguageLevelProjectExtension.<init>(CoreLanguageLevelProjectExtension.java:26)
            at org.jetbrains.kotlin.com.intellij.core.JavaCoreProjectEnvironment.<init>(JavaCoreProjectEnvironment.java:42)
            at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreProjectEnvironment.<init>(KotlinCoreProjectEnvironment.kt:26)
    Getting this error when running the video player component on openjdk-15. Has anybody seen this error?
    o
    • 2
    • 1
  • m

    Marin Tolić

    12/28/2020, 1:11 AM
    Is anyone else finding the drawer gestures to be highly unpredictable? I'm not sure what they react to and it feels like they sometimes just work and sometimes just don't.
    o
    • 2
    • 2
  • h

    Hamza

    12/28/2020, 11:29 AM
    Does compose have a file chooser/picker? I could not find anything.
    i
    t
    g
    • 4
    • 7
Powered by Linen
Title
h

Hamza

12/28/2020, 11:29 AM
Does compose have a file chooser/picker? I could not find anything.
i

Igor Demin

12/28/2020, 11:46 AM
You can use java.awt.FileDialog (it will open system file chooser): https://github.com/JetBrains/compose-jb/issues/176 (there is no Compose API for this at the moment).
t

Thomas

12/28/2020, 12:50 PM
@Igor Demin I am curious. Any reason why you suggest FileDialog instead of JFileChooser? As Compose Desktop uses Swing in several places, shouln't we do so in app code, too? ...as said, just curious...
h

Hamza

12/28/2020, 12:50 PM
Oh right. There is also swing interop. I wonder what is preferred
g

gildor

12/28/2020, 1:36 PM
JFileChooser doesn't use system file picker
👆 1
👍 5
i

Igor Demin

12/28/2020, 1:39 PM
JFileChooser
uses Swing to draw UI, so it has not ideal Look&Feel (even with
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())
).
JFileChooser
should be used only if functionality of FileDialog is not enough.
👍 2
t

Thomas

12/28/2020, 2:57 PM
@Igor Demin Sounds good, thanks. 👍
h

Hamza

12/29/2020, 2:00 AM
Thanks for the feedback guys! I appreciate it
View count: 17