Skip to content
Discussion options

You must be logged in to vote

it works only if it's pure UI, not if it's inside a ui.horizontal(...) or ui.vertical_centered(...), I've found a workaround for that that allow me to draw inside of the "box" Rect that the TextBox produces.

let rect = ui.add(TextEdit::singleline(&mut password)).rect();
draw_pwd_show_button(&rect, login_state, ui);

// To allow the show/hide password in login page.
// drows the button on the Right side of the password textbox
fn draw_pwd_show_button(rect: &egui::Rect, login_state: &mut LoginState, ui: &mut egui::Ui) {
    // to put a button inside a textbox
    let height = rect.height();
    let mut min = rect.min;
    let max = rect.max;
    min = pos2(max.x - height, min.y);
    let ne…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@itsNiccoloSabatini
Comment options

Answer selected by itsNiccoloSabatini
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants