Hi,
I am trying to disable copy+paste for a textfield.
I have came across the following code:
The above code works, but it adds the textfield when the page as it's adding the view at runtime.
For my project, I am loading a layout to the page which has the textfield in it and I am trying to make it so that the textfield from my layout can't have the copy+paste.
Is there a way I disable the copy+paste function of the textfield (textfield which is created from the layout) ?
I am trying to disable copy+paste for a textfield.
I have came across the following code:
B4X:
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.Title = "Page 1"
Page1.RootPanel.Color = Colors.White
NavControl.ShowPage(Page1)
Dim tf As TextField = CreateTextField
Page1.RootPanel.AddView(tf, 10dip, 10dip, 200dip, 50dip)
End Sub
Sub CreateTextField As TextField
Dim no As NativeObject
no = no.Initialize("MyTextField").RunMethod("new", Null)
Dim tf As TextField
tf = no
tf.BorderStyle = tf.STYLE_ROUNDEDRECT
Return tf
End Sub
#if OBJC
@end
@interface MyTextField : UITextField
@end
@implementation MyTextField
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
return NO;
}
#End If
The above code works, but it adds the textfield when the page as it's adding the view at runtime.
For my project, I am loading a layout to the page which has the textfield in it and I am trying to make it so that the textfield from my layout can't have the copy+paste.
Is there a way I disable the copy+paste function of the textfield (textfield which is created from the layout) ?