Kirill Grouchnikov
11/19/2020, 3:19 PMmorganbovi
11/19/2020, 10:23 PMKirill Grouchnikov
11/20/2020, 1:32 AMVadim Kapustin
11/20/2020, 8:33 AMabstract class DialogComponent(
componentContext: ComponentContext,
name: String,
) : Component(componentContext, name) {
private val _opened = mutableStateOf(false)
protected val _title = mutableStateOf(name)
fun open() { _opened.value = true }
fun close() { _opened.value = false }
@Composable
override fun render() {
if (!_opened.value) return
super.render()
Dialog(_title.value, onDismissEvent = ::close
) {
content()
}
}
@Composable
abstract fun content()
}
Now I can create a derived components with the implementation of content:
class LoginDialog(
componentContext: ComponentContext,
private val onLogged: (Operator) -> Unit
) : DialogComponent(componentContext, "Login") {
val password = remember { mutableStateOf("") }
// ...
@Composable
override fun content() {
// ...
Button(
onClick = {
if (controller.authorize(operator, password.value))
onLogged(operator)
password.value = ""
close()
}
}
) {
Text("Login")
}
}
}
Then I can call window rendering in the root component:
//...
private val dialog = LoginDialog(componentContext,onAuthorize)
@Composable
override fun render() {
// ...
Button(onClick = dialog::open) { Text("Login") }
dialog.render()
// ...
}
So, what do you think about this approach?Glen
11/20/2020, 9:01 AMsaket
11/20/2020, 5:42 PMspierce7
11/20/2020, 5:46 PMKirill Grouchnikov
11/20/2020, 5:49 PMpakoito
11/20/2020, 5:50 PM> Task :desktop:run FAILED
dyld: lazy symbol binding failed: Symbol not found: _objc_alloc_init
Referenced from: /Users/paco/.skiko/b9408918342fa3c0511232e1869d6b3885a57b45a57800586f357a2461785a4e/libskiko.dylib (which was built for Mac OS X 10.15)
Expected in: /usr/lib/libobjc.A.dylib
Are there any plans to provide binaries that are backwards compatible, or will Big Sur be the baseline for C4D apps?Timo Drick
11/21/2020, 12:32 AMJohn O'Reilly
11/21/2020, 11:12 AMJohn O'Reilly
11/21/2020, 3:18 PMlaunchInComposition
is no longer available in latest build?Dominaezzz
11/21/2020, 10:23 PMPopup { ... }
yet? When I do it, the popup renders in place, like in a stack view or something.alilosoft
11/21/2020, 11:07 PMOussama Haff.
11/22/2020, 10:23 AMuseIR = true
jordan29.04.1197
11/22/2020, 7:25 PM@Composable
fun marketView(market: Market) {
@Composable
fun marketParamRow(children: @Composable RowScope.() -> Unit) {
Row(
horizontalArrangement = Arrangement.SpaceBetween,
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 4.dp),
children = children)
}
Column(modifier = Modifier
.fillMaxWidth()
.padding(8.dp)) {
marketParamRow {
val resultKindStage = remember { mutableStateOf(market.resultKind?.toString() ?: "") }
Text("resultKind")
TextField(
modifier = Modifier.width(50.dp),
maxLines = 1,
value = resultKindStage.value,
onValueChange = {
resultKindStage.value = it
},
)
}
marketParamRow {
Text("marketType")
Text(market.marketType.toString())
}
marketParamRow {
Text("period")
Text(market.period.toString())
}
marketParamRow {
Text("subPeriod")
Text(market.subPeriod.toString())
}
}
}
Does somebody can help me?spierce7
11/23/2020, 12:44 AMspierce7
11/23/2020, 3:34 AMAnaniya
11/23/2020, 1:51 PMxetra11
11/23/2020, 4:59 PMxetra11
11/23/2020, 5:05 PM@Preview
annotation for UI preview? I am completly new to Compose and that stuff. Using Kotlin only for Web Backend EngineeringKirill Grouchnikov
11/23/2020, 6:14 PMspierce7
11/23/2020, 6:58 PMOussama Haff.
11/23/2020, 8:16 PMxetra11
11/23/2020, 9:42 PMspierce7
11/24/2020, 12:18 AMxetra11
11/24/2020, 11:58 AM@Composable
fun CharacterModuleView() {
Button(
onClick = {
LOG().info("clicked")
}
){
Text("Import Characters")
}
}
When clicking the button I'd like to open a new window like a dialog-popup to ask the user for a file path. I tried to put a "Window" in there which did not work. However there is a way to do that I assume eh?Kirill Grouchnikov
11/24/2020, 6:51 PMclickable
and toggleable
modifiers? When I do the "regular" down/up mouse click, I see the matching onClick
and onValueChange
getting fired. But if I do a mouse down, wait for a second or so, and then do a mouse up, those lambdas do not get fired.Kirill Grouchnikov
11/24/2020, 6:52 PMMartin Nowosad
11/25/2020, 9:02 AMMartin Nowosad
11/25/2020, 9:02 AMxetra11
11/25/2020, 9:21 AMplugins {
kotlin("jvm") version "1.4.20"
id("org.jetbrains.compose") version "0.2.0-build128"
}
Martin Nowosad
11/25/2020, 9:43 AMxetra11
11/25/2020, 10:15 AMMartin Nowosad
11/25/2020, 10:17 AM