From 6144e9f244abfd15687de00b6cfda6b4606f351a Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Fri, 3 Nov 2023 10:07:10 +1100 Subject: [PATCH] add set enabled to textfield --- src/input/mod.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/input/mod.rs b/src/input/mod.rs index 998feab..fcb60bd 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -415,6 +415,16 @@ impl TextField { let _: () = msg_send![obj, setFont:&*font]; }); } + + /// Enable/disable this field. + pub fn set_enabled(&self, enabled: bool) { + self.objc.with_mut(|obj| unsafe { + let _: () = msg_send![obj, setEnabled:match enabled { + true => YES, + false => NO, + }]; + }); + } } impl ObjcAccess for TextField {