Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    antoyo
    @antoyo
    https://github.com/antoyo/relm/blob/f580d4597704d6d1e8d3654f1544851159b7cec8/relm-examples/tests/checkboxes.rs#L156 (sorry, this is using an non-release that broke the API, but you just need to call emit() on the component). The first two only bind a message to send another message.
    laurent bernabé
    @loloof64
    Thank you very much :smiley: I'm gonna investigate into these links :smiley:
    Indeed, I forgot the connect! macro :laughing:
    antoyo
    @antoyo
    Yeah, this macro supports many different syntaxes.
    laurent bernabé
    @loloof64

    Hi! I'm facing an issue with the view! macro :

     view! {
            gtk::ScrolledWindow(None::<&gtk::Adjustment>, None::<&gtk::Adjustment>) {
                policy: PolicyType::Automatic, PolicyType::Automatic,
                #[name="main_zone"]
                gtk::FlowBox {
    
                }
            }
        }

    I'm trying to set up the policy for ScrolledWindow, but

    error: expected curly braces
      --> src/graphic/history_component.rs:28:65
          |
    28 |             policy: PolicyType::Automatic, PolicyType::Automatic,
          |

    But adding curly braces after this line 28 also raises errors.

    I've just tried to follow official documentation for ScrolledWindowExt : https://gtk-rs.org/docs/gtk/trait.ScrolledWindowExt.html#tymethod.set_policy.

    I've also tried with a tuple (PolicyType::Automatic, PolicyType::Automatic)
    laurent bernabé
    @loloof64

    Finally, set the policy manually :

    fn init_view(&mut self) {
            self.root.set_policy(PolicyType::Automatic, PolicyType::Automatic);
        }

    But would also be interested if this could be done directly in the view! macro call.

    antoyo
    @antoyo
    @loloof64: Relm doesn't support setting multi-argument properties for now: antoyo/relm#59 . In this link, you see the workaround of using hscroll_policy and vscroll_policy for your use case.
    laurent bernabé
    @loloof64
    Thank you, indeed, I could have found these simpliest versions from the Gtk-rs documentation. It is because I am not yet used to Gtk development.
    laurent bernabé
    @loloof64
    Finally wrote back manual setting from init function, as ScrolledWindowExt does not support set_hscroll_policy, and same for set_vscroll_policy.
    laurent bernabé
    @loloof64
    Thank you : I'll look at it right now. :smiley: Also, is there a way to specify the pack_start, pack_end from the view! macro ? As I am trying to set a Ground and a ScrolledWindow side by side (horizontally), but the Ground is always centered in my game zone, and the ScrolledWindow has little room.
    antoyo
    @antoyo
    What do you mean? The order in which you add the element in the macro will be the order in the Box. You can try setting hexpand if I understand correctly.
    laurent bernabé
    @loloof64
    So, I think this has to do with hexpand : I'll play with this. Found this : https://gtk-rs.org/docs/gtk/trait.WidgetExt.html#tymethod.set_hexpand. Allright.
    laurent bernabé
    @loloof64
    I am trying to set style on my custom component with a css file :
    fn init_view(&mut self) {
            let style = include_bytes!("./game_zone.css");
            let provider = CssProvider::new();
            provider
                .load_from_data(style)
                .expect("Failed to read css style for GameZone !");
            self.history
                .get_style_context()
                .add_provider(&provider, STYLE_PROVIDER_PRIORITY_APPLICATION);
        }
    But my custom history component has no method get_style_context()
    antoyo
    @antoyo
    Try self.history.widget().get_style_context().
    laurent bernabé
    @loloof64
    Thank you :smile:
    oofdog
    @oofdog
    hey, are you familiar with https://github.com/bodil/vgtk
    antoyo
    @antoyo
    @oofdog: I've heard of it, but never used it.
    oofdog
    @oofdog
    yeah cuz they're the same
    inspired by elm
    antoyo
    @antoyo
    Yeah, they use a slightly different approach.
    oofdog
    @oofdog
    yeah, not much different though
    oofdog
    @oofdog
    any interest in joining the two projects?
    duplication of effort : /
    antoyo
    @antoyo
    I don't really like their approach and since vgtk appeared after relm, I guess they had good reasons to start a different project.
    oofdog
    @oofdog
    i notice in vgtk you can do this
    <ListBox selection_mode=SelectionMode::None>
            {
                self.tasks.iter().enumerate().map(|(index, task)| task.render(index))
            }
        </ListBox>
    is there a similar way to render a list of items and map them to a component
    (in relm)
    antoyo
    @antoyo
    No, not yet.
    oofdog
    @oofdog
    hm ok.
    so how can we render a list of items in relm?
    antoyo
    @antoyo
    oofdog
    @oofdog
    thanks
    oofdog
    @oofdog
    hey, is there any examples on how to use a combobox
    seems like i have to use a list store i think, the same model that treeview uses
    antoyo
    @antoyo
    @oofdog: I can't find any.
    oofdog
    @oofdog
    hm ok
    antoyo
    @antoyo
    Yep, you have to do it the gtk-rs way, unfortunately.
    oofdog
    @oofdog
    i'm gonna try that
    oofdog
    @oofdog
    yup that worked. thanks.
    btw what if the model changed? like if i add another option asynchronously? will the view update automatically?
    antoyo
    @antoyo
    You'll have to call set_model() manually.
    oofdog
    @oofdog
    ok
    oofdog
    @oofdog
    i saw your mg framework. looks nice. still alpha? what problems does it solve?
    antoyo
    @antoyo
    @oofdog: mg is something like girara (https://pwmt.org/projects/girara/): it basically gives you vim-like functionality (key bindings, modes, commands, settings, …). Where does it say it's in alpha? mg is the library used by my web browser titanium. It's fairly stable, though I believe I introduce a bug in the last version.