https://kotlinlang.org logo
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
  • t

    Torsten Wiederkehr

    02/21/2022, 6:09 PM
    Are there any tutorials which show how to write tests for Compose for Desktop?
    h
    p
    g
    • 4
    • 6
  • t

    theapache64

    02/21/2022, 8:46 PM
    Why neither
    onPress
    nor
    onTap
    getting triggered on
    Button
    ? 🤔 🧵
    d
    k
    • 3
    • 6
  • m

    Matthew Laser

    02/22/2022, 1:35 AM
    is it possible to play sythesized (or, any actually) sounds in Compose Desktop? I was trying to play around with both the
    javax.sound.midi
    package, as well as the JSyn package. I was able to get the same code playing sounds from a swing
    JApplet
    , but haven't been able to hear anything coming out of Compose. Anyone have any ideas?
    k
    y
    • 3
    • 3
  • l

    lhwdev

    02/22/2022, 2:59 AM
    I'm trying to implement something that enables undecorated Compose Window to utilize native window features, like snapping, dragging, resizing. I'd already implemented it(in fact mostly copy-pasted) and seems to work, but it implements its hit test by itself. I want it to utilize hit test logic from Compose UI. How can I do that? Note: I cannot sure if it is called on the UI thread, I only know that it is called from the listener passed to SetWIndowLongPtrA(hwnd, GWLP_WNDPROC, this one).
    k
    • 2
    • 6
  • x

    xxfast

    02/22/2022, 10:27 PM
    is there a way to make the titleBar support dark mode?
    e
    m
    +2
    • 5
    • 14
  • k

    Kebbin

    02/23/2022, 5:28 AM
    @xxfast I found the Transparent Window code you might like to look at: https://github.com/JetBrains/compose-jb/blob/master/tutorials/Window_API_new/README.md#transparent-windows-eg-allows[…]make-windows-of-a-custom-form
    👍 4
    k
    • 2
    • 3
  • d

    David W

    02/24/2022, 12:54 AM
    Why does setting icon size change text width/wrapping in a DropdownMenuItem?
    DropdownMenuItem(
                                onClick = {...}) {
                                    Icon(
                                        painter = painterResource(item.iconPath),
                                        modifier = Modifier.padding(end = 4.dp),//.size(24.dp),
                                        contentDescription = null
                                    )
                                    Text(
                                        text = item.text
                                    )
                                }
                            }
    .size
    commented out = left, wrapped. not commented out = right, not wrapped. This is on Compose
    1.1.0-rc01
    , but also happens on
    1.0.1
    .
    a
    • 2
    • 1
  • k

    Kebbin

    02/24/2022, 4:06 AM
    Question: What's the best way to keep a vertically scrollable Text object, whose content is always added to, always scrolled to the bottom by default? Thanks!
    👀 2
    t
    • 2
    • 6
  • u

    毛小川

    02/24/2022, 6:18 AM
    Question: How can I get a "only enter numbers"
    TextField
    ?
    a
    • 2
    • 2
  • e

    Emily V

    02/24/2022, 6:35 PM
    Hi all, where can I find documentation about Menu items? FrameWindowScope.MenuBar.. or how to add them basically and different APIs that are available?
    k
    • 2
    • 3
  • s

    SrSouza

    02/25/2022, 12:21 AM
    Curious question about Skiko implementation: Why the JNI implementation is written in C++ and not exposed by Kotlin Native? I saw couple examples using KN for JNI. I'm looking to understand that because I'm starting a library multiplatform that will require JNI for JVM.
    g
    a
    • 3
    • 18
  • u

    毛小川

    02/25/2022, 2:05 AM
    Hello, I have a global
    Coroutines
    (img1)to read something(?), when it's not null ,I want send this to a function`@Composable` for update variables(
    mutableStateOf
    ) ,How can I achieve? thanks!
    g
    t
    • 3
    • 27
  • b

    Brendan Campbell-hartzell

    02/25/2022, 7:57 AM
    I currently have a tornadofx app that I'd like to gradually move to compose. Is there a way to make them play together nicely?
    z
    • 2
    • 7
  • j

    Javier

    02/25/2022, 10:59 AM
    Anyone found this issue?
    Could not find org.jetbrains.compose.compiler:compiler:1.1.0.
    g
    • 2
    • 4
  • s

    Spikey Sanju

    02/25/2022, 3:24 PM
    Hi folks, I was wondering if it would be possible to install
    Desktop Compose App
    as a
    DMG file
    on
    M1 MacBook
    ?
    s
    c
    a
    • 4
    • 6
  • s

    Spikey Sanju

    02/26/2022, 7:13 AM
    Why My
    SQL Delight's
    Todo notes app are not persisting data when I install My
    Desktop Compose  App
    as
    DMG
    file on my
    M1 Macbook
    ? But everything works fine on my dev machine.
    g
    • 2
    • 4
  • k

    Kebbin

    02/26/2022, 11:08 AM
    Hello all, I'm stumped trying to get a
    Text
    object's contents in a
    @Composable
    to update when a global String variable changes. I have a global String
    var dataIn = ""
    that regularly fills with characters like
    data += char
    in one function, but I can't get its value change to recompose the displayed
    Text
    in the other function! I thought it should be doable using
    var dataDisplay: String = remember { mutableStateOf(dataIn) }
    and
    Text(text = dataDisplay)
    but it won't update the text display every time a new char is added to the
    dataIn
    variable. Thanks again!
    m
    z
    • 3
    • 11
  • k

    Kebbin

    02/26/2022, 11:53 AM
    Also, how do you handle trying to call a
    @Composable
    function from a
    Window()
    's
    MenuBar
    ??? I can't do it from a
    Window
    in the
    main
    function, as that can't be
    @Composable
    , and a
    @Composable
    can't be called from anything but a
    @Composable
    ? But a
    Window
    in a
    @Composable
    function still can't seem to do it! Sorry! Thanks! 🥴
    m
    z
    • 3
    • 6
  • s

    spierce7

    02/26/2022, 8:57 PM
    Would it be possible for me to use Compose to render an image on a server?
    m
    • 2
    • 2
  • k

    Kebbin

    02/27/2022, 11:27 AM
    Hello, I'm having trouble specifying a path to an image file to use in a Composable. See in thread please. Thanks.
    z
    • 2
    • 4
  • u

    毛小川

    02/28/2022, 3:11 AM
    Hello! Could I maximize the window startup?
    k
    r
    • 3
    • 6
  • l

    luen

    02/28/2022, 1:09 PM
    The problem is this: how to decode avframe in skia image? Here is my code. Take an example from here. I dont know how to write it in kotlin.
    k
    • 2
    • 3
  • a

    Alexander Maryanovsky

    02/28/2022, 1:56 PM
    It seems
    Modifier.focusable(false)
    doesn’t work on buttons. I took the first focus example from https://github.com/JetBrains/compose-jb/tree/master/tutorials/Tab_Navigation and added a button at the bottom:
    TextButton(
        onClick = { println("Clicked") },
        modifier = Modifier.focusable(false)
    ){
        Text("Click me")
    }
    and the button still participates in focus navigation, and when it has focus and I press ENTER, it prints “Clicked”. Is it a bug or am I misunderstanding what
    focusable(false)
    should do?
    r
    • 2
    • 5
  • a

    Alexander Maryanovsky

    02/28/2022, 8:57 PM
    I’m trying to create a
    Column
    with a
    VerticalScrollBar
    that grows with its contents until it reaches the maximum available space and then becomes scrollable. The code looks approximately like this:
    Box{
        Column(
            modifier = Modifier.verticalScroll(scrollState)
        ) {
            ...
        }
        VerticalScrollbar(
            modifier = Modifier.align(Alignment.CenterEnd).matchParentSize()
        )
    }
    Without the scrollbar, it works fine. Unfortunately, as soon as I add the scrollbar, it stretches the
    Box
    to fill all the available height. It doesn’t seem to respect the
    matchParentSize
    modifier.
    t
    • 2
    • 2
  • u

    毛小川

    03/01/2022, 11:42 AM
    Hello! what column layout I use so that the wrapped rows is vertical scrollable ,I tried
    LazyColumn
    , but not compiling.Such as:
    LazyColumn(
        //
    ){
        mutableStateArrays.forEachIndexed { index, value ->
            Row(
                modifier = Modifier.padding(top = 10.dp),
                horizontalArrangement = Arrangement.Center
            ) {
                OutlinedTextField(
                    //
                )
                DropdownMenu(
                    //
                ) {
                    //
                }
            }
        }
    }
    a
    • 2
    • 1
  • u

    毛小川

    03/03/2022, 6:42 AM
    Hello! Could I get the application's work path when running? I tried
    System.getProperty("user.dir")
    ,when running from
    .exe
    ,it throw exception.I want get the application's path because of export log
    j
    • 2
    • 2
  • f

    felislynx

    03/03/2022, 7:57 AM
    Hi, i’ve problem with signing dmg. I’ve followed instruction from https://github.com/JetBrains/compose-jb/tree/master/tutorials/Signing_and_notarization_on_macOS. My team account holder created Developer Id certificate, it is returned by
    /usr/bin/security find-certificate -c "Developer ID Application"
    I’ve filled gradle configuration and packageDmg fails, with exit code 1 for task “Execution failed for task ‘:createDistributable’.“. If i run command that fails i get “no matches found: <my cert id>”
    • 1
    • 1
  • r

    ralf

    03/04/2022, 5:08 PM
    Is it possible to override the Compose compiler version? I’m currently testing Kotlin 1.6.20 and Google provides a special build for the Compose Compiler
    1.2.0-dev-k1.6.20-RC-21f332eaa05
    . Does Jetbrains provide a similar build for Desktop?
    o
    j
    • 3
    • 4
  • d

    David W

    03/05/2022, 5:06 AM
    If my CfD app folder is siblings with a folder named
    jre
    that contains a jre, the exe appears to try to use that JRE instead of the one in the exe's folder.
    ./ComposeApp/app.exe
    ./jre/bin/java.exe
    It crashes before even getting to my Main method, and running it from cmd outputs:
    C:\Program Files (x86)\Fractal Softworks\Starsector\SMOL_Dist> .\SMOL.exe
    Error: could not open `C:\Program Files (x86)\Fractal Softworks\Starsector\jre\lib\jvm.cfg'
    (not that the
    jre
    folder is
    ../jre
    , relative to the exe) If I move the application folder anywhere else, it runs fine. If I rename
    jre
    to anything else, it runs fine. Anyone have any ideas as to what could be causing this? I don't want it to have any interaction with that jre folder, it's pure coincidence that many users are placing it next to a
    jre
    folder.
    • 1
    • 1
  • p

    pajatopmr

    03/05/2022, 9:06 AM
    In this thread I will be teasing out Compose for Desktop with code coverage. The strategy is to let IntelliJ generate the Hello, Desktop basic app and then add infrastructure to eventually get a sensible code coverage report for this trivial app.
    i
    • 2
    • 11
Powered by Linen
Title
p

pajatopmr

03/05/2022, 9:06 AM
In this thread I will be teasing out Compose for Desktop with code coverage. The strategy is to let IntelliJ generate the Hello, Desktop basic app and then add infrastructure to eventually get a sensible code coverage report for this trivial app.
The IntelliJ version information is: IntelliJ IDEA 2021.3.1 (Ultimate Edition) Build #IU-213.6461.79, built on December 28, 2021 Licensed to Argus / Paul Reilly Subscription is active until October 1, 2022. For non-commercial open source development only. Runtime version: 11.0.13+7-b1751.21 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 12.2.1 GC: G1 Young Generation, G1 Old Generation Memory: 2048M Cores: 10 Non-Bundled Plugins: com.intellij.nativeDebug (213.6461.6) org.jetbrains.kotlin (213-1.6.10-release-944-IJ6461.79) Statistic (4.1.7) Kotlin: 213-1.6.10-release-944-IJ6461.79
Using defaults, the app builds and runs without a hitch and generates the expected output (after clicking on the button):
Next step is to add the Kover plugin to the build script:
id("org.jetbrains.kotlinx.kover") version "0.4.2"
A Gradle run of the clean and build tasks is successful at doing nothing. Next step is to add a Kover configuration, borrowing from another project so that the kover configuration is:
kover {
isEnabled = true
coverageEngine.set(kotlinx.kover.api.CoverageEngine.INTELLIJ)
intellijEngineVersion.set("1.0.622")
generateReportOnCheck.set(true)
}
Another clean, build Gradle run still is successful at doing nothing. Hmmm. that is a surprise that nothing different happened ... my expectation was that kover would run and complain that nothing was covered. Next step is to figure out why there is no report and why Gradle thinks that the report is up-to-date. Hmmm. If you've been following along and have some idea about what is wrong, do tell. I'll be back when I figure out the answers to those two questions.
Ah, that was easy. There were no tests. Adding a simple test to do nothing works and a report is generated. I'll take a break here to go generate a YouTrack issue that IntelliJ ought to generate basic, really simple, tests for Compose Multiplatform.
Next, I added a simple test and created a Gitlab project for this thread. As you can see from the attached screen shot, the test passes but also throws an exception. I am still struggling trying to explain the exception in an actionable way. Looks very much like a Compose Multiplatform bug. @olonho or @Igor Demin would you agree?
i

Igor Demin

03/08/2022, 7:01 PM
I have this error on Compose 1.0.0, but don’t have on Compose 1.1.0
p

pajatopmr

03/08/2022, 7:04 PM
Good to know. It also raises the questions: should a bug report be filed on 1.0.0 or should 1.1.0 be preferred. My preference is the latter.
i

Igor Demin

03/08/2022, 7:31 PM
1.1.0 is released, so no need in bug report
p

pajatopmr

03/09/2022, 6:19 AM
Preferring the Compose plugin version 1.1.0 actually generates a valid coverage report. Hallelujah! But to get there, the following build and code changes were required (and have been pushed to the Gitlab repo mentioned above):
🎉 1
And that's a successful wrap for this thread.
View count: 3