Giter Site home page Giter Site logo

Comments (3)

AaronErhardt avatar AaronErhardt commented on May 19, 2024

There are two options:

  1. You store the value of the entry in your model. The easiest way to do this is to create an EntryBuffer and store it inside the model. Then you use set_buffer to set the buffer of the entry in the view! macro. Whenever you want to get the value of the entry you can the just call self.buffer_name.text() in the update method.

  2. You name your entries and move them into the button closure:

connect_clicked(sender, entry1_name, entry2_name) => move |_| {
   let user_name = entry1_name.buffer().text();
   let password = entry2_name.buffer().text();
   send!(sender, AppMsg::Login((user_name, password)));
},

I hope this helps you :)

from relm4.

QuintinTao avatar QuintinTao commented on May 19, 2024

it does help me!thanks
By the way how can I learn relm? I need some doc to learn API .

There are two options:

  1. You store the value of the entry in your model. The easiest way to do this is to create an EntryBuffer and store it inside the model. Then you use set_buffer to set the buffer of the entry in the view! macro. Whenever you want to get the value of the entry you can the just call self.buffer_name.text() in the update method.
  2. You name your entries and move them into the button closure:
connect_clicked(sender, entry1_name, entry2_name) => move |_| {
   let user_name = entry1_name.buffer().text();
   let password = entry2_name.buffer().text();
   send!(sender, AppMsg::Login((user_name, password)));
},

I hope this helps you :)

It does help me. Thanks .by the way where can I learn relm.I mean the api.

from relm4.

AaronErhardt avatar AaronErhardt commented on May 19, 2024

You can learn Relm4 with the book, the examples or the documentation. You can find all those links in the Readme.
Also, this article might help you: https://aaronerhardt.github.io/blog/posts/gui_speedrun/

from relm4.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.