微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

当有很多孩子时如何从特定的孩子按钮获取文本

如何解决当有很多孩子时如何从特定的孩子按钮获取文本

我有6个按钮。每个都有不同的文本。按下任意按钮将调用一种相同的方法,该方法可更改文本并更改它们之间的按钮位置。按下按钮时,我无法弄清楚如何从特定按钮获取文本。我只能返回随机按钮文本或全部返回。像这样:

<a> @ <b>

所以我需要任何建议。谢谢。

buttons

解决方法

您可以将pub struct Thing { value: i32,} impl Thing { pub fn new(value: i32) -> Thing { Thing { value,} } fn in_thread(&self) { println!("in thread"); // do things that block the thread } pub fn spawn_thread(&self) { std::thread::spawn(move || { self.in_thread(); // problem occurs here }); } } 添加到int之类的按钮单击功能中,然后根据ReadFromButton(int i)

在onclickevent中统一给按钮编号。

赞:

public Text[] buttontexts

但是我相信还有更多的方法可以做到这一点。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。