!DlltQISlgRGacjtFQD:matrix.org

Relm4

203 Members
Build truly native applications with ease!35 Servers

Load older messages


SenderMessageTime
9 Feb 2024
@ejaa3:matrix.orgEduardo ✞ changed their profile picture.02:57:51
@wipi:matrix.orgwipi Theoretical question: I have main component and a few sub-components that represent steps of a wizard. In React, or some other languages/frameworks, when I press "Next" button in sub-component, then I invoke some callback passed from parent component. If that callback fails with error, then the sub-component displays error.
In general the sub-component delegates action somewhere, but knows how to present result to the user.
With Relm4 I see, that components talk to each other using "output/input" signals. However I don't see if whoever invokes sender.output or sender.input can learn about the result of the action.
12:17:30
@aaron:matrix.aaron-erhardt.deAaron Erhardt I think you have to respond with an output message if you want to indicate success or error to the parent component. 12:25:59
@tornax:matrix.orgtornaxis it somehow possible to wait for an async job to be finished?22:24:20
@tornax:matrix.orgtornax * is it somehow possible to wait for an async job to be finished before continueing?22:24:27
@tornax:matrix.orgtornax because I'd like to create a notification before calling relm4::main_application().quit() 22:24:53
@tornax:matrix.orgtornax but there's a race-condition at the moment between relm4::main_application().quit() and sender.command(|| <create-notification>) 22:25:35
@tornax:matrix.orgtornaxof course one obvious solution would be using something like a lock22:25:58
@tornax:matrix.orgtornax I need a way to call async functions but within a Component 22:29:14
@tornax:matrix.orgtornax * I need a way to call async functions but within a Component. Is there a better way than using sender.command or its variants? 22:29:43
@tornax:matrix.orgtornax and why is run_async not an async-function? 22:52:26
@tornax:matrix.orgtornaxoh lol22:56:15
@tornax:matrix.orgtornax https://docs.rs/relm4/0.7.0-beta.2/relm4/fn.spawn.html 22:56:16
@tornax:matrix.orgtornaxok, I found a clean solution23:13:37
@tornax:matrix.orgtornax I don't know why relm4::JoinHandle doesn't implement a .join() function as I'd expect but now I'm using std::thread::spawn for this where its join handle does have .join() 23:14:41
@tornax:matrix.orgtornax Ok, looks like that it's due to tokio that relm4::JoinHandle doesn't implement .join. You should use .await for it.. 23:17:09
14 Feb 2024
@tedbyron:matrix.orgTeddy Byron changed their display name from ted to Teddy Byron.22:20:07
16 Feb 2024
@souperusr:matrix.orgsouperusr joined the room.19:33:56
19 Feb 2024
@edav.mx:matrix.orgedav.mx joined the room.17:50:59
@wipi:matrix.orgwipiIs there any converter of GtkBuilder files to view! Macro?22:12:39
20 Feb 2024
@aaron:matrix.aaron-erhardt.deAaron ErhardtI don't think so, but maybe there is something for Blueprint? The syntax of Blueprint is quite similar to the view macro which would at least significantly reduce the amount of work required to convert it to the view macro syntax.08:29:39
@wipi:matrix.orgwipiI wanted to use glade or Cambalache to design the UI and then import that to Realm.09:39:18
22 Feb 2024
@wipi:matrix.orgwipiWhat's the best way to show dialog centered on top of app window? Action is fired from sub component.16:11:15
27 Feb 2024
@wipi:matrix.orgwipi

I've got a label that is ellipsized. I want it to show whole content, when clicked. Apparently I cannot use connect_clicked, but gtk4 states that all widgets support all signals. There's also this sample in gtk-rs book:

 button.connect_closure(
        "clicked",
        false,
        closure_local!(move |button: Button| {
            // Set the label to "Hello World!" after the button has been clicked on
            button.set_label("Hello World!");
        }),
    );

What's the proper way to get it done in Relm4?

16:24:40
@aaron:matrix.aaron-erhardt.deAaron Erhardt

gtk4 states that all widgets support all signals

There are signals that are common across all widgets, but I'm not sure whether clicked is one of them. In general, gtk-rs generates methods for all available signals, such as connect_clicked where available. So I recommend using a button and styling it according to your needs instead of trying to get a label to do the same.

16:27:23
1 Mar 2024
@dianqk:matrix.orgdianqk set a profile picture.02:07:35
@eluioda:matrix.orgsgued

Hey guys. I'm trying to set the focus to one spcefic element when reacting to a specific message. What's the best way to do that. 

This reminds me a lot of the trick of using Cell and ? to react to changes like to add a toast. But this time this does not work because grab_focus takes no argument.

19:13:03
@eluioda:matrix.orgsgued *

Hey guys. I'm trying to set the focus to one spcefic element when reacting to a specific message. What's the best way to do that. 

This reminds me a lot of the trick of using Cell<Option<Toast>> and ? to react to changes like to add a toast. But this time this does not work because grab_focus takes no argument.

19:14:25
@aaron:matrix.aaron-erhardt.deAaron Erhardt You could use #[track = "model.focus.take()"] and grab: (()) with Cell<bool> for model.focus 19:51:22
@eluioda:matrix.orgsguedThanks, that worked21:05:01

There are no newer messages yet.


Back to Room ListRoom Version: 6