use fltk::{enums::*, prelude::*, *}; use std::ops::{Deref, DerefMut}; pub struct RtlInput { inp: input::Input, } impl RtlInput { pub fn new(x: i32, y: i32, w: i32, h: i32, label: &'static str) -> Self { let mut inp = input::Input::new(x, y, w, h, label).with_align(Align::Right); let mut frame = frame::Frame::new(x, y, w, h, None).with_align(Align::Inside | Align::Right); frame.set_frame(FrameType::DownBox); frame.set_color(Color::White); inp.set_trigger(CallbackTrigger::Changed); inp.set_callback(move |i| { frame.set_label(&i.value()); }); Self { inp } } } impl Deref for RtlInput { type Target = input::Input; fn deref(&self) -> &Self::Target { &self.inp } } impl DerefMut for RtlInput { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.inp } } fn main() { let app = app::App::default(); let mut win = window::Window::default().with_size(400, 300); let _inp = RtlInput::new(160, 190, 100, 40, "الاسم"); win.end(); win.show(); app.run().unwrap(); }