egui icon indicating copy to clipboard operation
egui copied to clipboard

How to copy the text?

Open goldwind-ting opened this issue 2 years ago • 4 comments

ScrollArea::vertical().auto_shrink([false; 2]).show_rows(
                ui,
                row_height,
                num_rows,
                |ui, row_range| {
                    for row in row_range {
                        if row == 0 {
                            ui.columns(3, |columns| {
                                columns[0].label("Desc");
                                columns[1].label("Account");
                                columns[2].label("Password");
                            });
                        } else {
                            if row - 1 >= self.data.len() {
                                break;
                            }
                            let col = &self.data[row - 1];
                            ui.columns(3, |columns| {
                                columns[0].label(&col[0]);
                                columns[1].label(&col[1]);
                                columns[2].label(&col[2]);
                            });
                        }
                    }
                },
            );

how to copy the text in the columns? image

goldwind-ting avatar Sep 09 '22 08:09 goldwind-ting

Maybe it's good idea to just take a look at font book on demo example, if you click the emoji symbol it will be automatically copied to the clipboard.

ar37-rs avatar Sep 09 '22 10:09 ar37-rs

it is a little bit different, I want to drag the cursor to select text in the column.

goldwind-ting avatar Sep 09 '22 11:09 goldwind-ting

I have the same question how to copy text from text_edit ? I even tried like this, but does not work: if ui.text_edit_singleline(link_to_profile).clicked() { ui.output().copied_text = link_to_profile.to_string(); }

Any ideas how to copy text CTRL + C on text edit?

0xFar5eer avatar Sep 16 '22 07:09 0xFar5eer

Would like this feature as well.

Unless something changed since the last answer in this thread Selecting (label) text with a mouse and copying it has not been implemented yet.

Junoburger avatar Sep 16 '22 21:09 Junoburger

This has been implemented in #3814 and #3870, so I think this issue can be closed.

YgorSouza avatar Feb 04 '24 15:02 YgorSouza