I don't think that this should be happening, but I can select text in multiple TextBoxes at once.

If I start typing I only replace the text in the focused one, but I don't think it's aesthetically pleasing to be able to select text in multiple Boxes.
Code
let items = ["Number0", "Number1", "Number2", "Number3", "Number4", "Number5", "Number6", "Number7", "Number8", "Number9"];
let mut layout = Flex::column();
for item in items.iter() {
let text = item.to_string();
let original_text: Flex<AppData> = Flex::column()
.with_child(Label::new( format!("{}", text)));
let translated_text: Flex<AppData> = Flex::column()
.with_child(TextBox::new().with_placeholder(format!("t{}t", text)).fix_width(TEXT_BOX_WIDTH).lens(AppData::text));
let item_layout: Flex<AppData> = Flex::row().with_child(original_text).with_child(translated_text);
layout.add_child(item_layout);
}
Scroll::new(layout)
I've played around a bit with some apps on my system (Linux) and both GTK and QT as well as VS Code clear single line text boxes when text is being selected somewhere else in the window. So I think doing the same in Druid would be reasonable.
This should probably be done through a command, something like TEXT_SELECTED: Selector<WidgetId>. That way the widget sending the command can ignore it based on the payload and other single line text edit widgets could clear themselves when receiving the command with a different id.
I think the correct fix here is to have the text box clear the selection when it loses focus.
The simplest way I can think of is to draw selection rect in paint() only if TextBox is focused.
// Draw selection rect
- if !self.selection.is_caret() {
+ if is_focused && !self.selection.is_caret() {
Will write a fix tomorrow.