[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_InputStyleChangedSignal")]
public static extern global::System.IntPtr TextEditor_InputStyleChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_MaxLengthReachedSignal")]
+ public static extern global::System.IntPtr TextEditor_MaxLengthReachedSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
+
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditorSignal_Empty")]
public static extern bool TextEditorSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1);
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_TextEditorSignal")]
public static extern void delete_TextEditorSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
-
+
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_SWIGUpcast")]
public static extern global::System.IntPtr TextEditor_SWIGUpcast(global::System.IntPtr jarg1);
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_TextEditor_Property_SCROLL_BAR_FADE_DURATION_get")]
public static extern int TextEditor_Property_SCROLL_BAR_FADE_DURATION_get();
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_Property_MAX_LENGTH_get")]
+ public static extern int TextEditor_Property_MAX_LENGTH_get();
+
//manual pinvoke for text-editor ScrollStateChangedSignal
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_ScrollStateChangedSignal")]
public static extern global::System.IntPtr TextEditor_ScrollStateChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
}
}
+ /// <summary>
+ /// The MaxLength property.
+ /// </summary>
+ /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int MaxLength
+ {
+ get
+ {
+ return (int)GetValue(MaxLengthProperty);
+ }
+ set
+ {
+ SetValue(MaxLengthProperty, value);
+ NotifyPropertyChanged();
+ }
+ }
+
/// Only used by the IL of xaml, will never changed to not hidden.
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool IsCreateByXaml
//You should not access any managed member here except static instance.
//because the execution order of Finalizes is non-deterministic.
- if (this.HasBody() && _textEditorTextChangedCallbackDelegate != null)
+ if (this.HasBody())
{
- TextChangedSignal().Disconnect(_textEditorTextChangedCallbackDelegate);
+ if(_textEditorTextChangedCallbackDelegate != null)
+ {
+ TextChangedSignal().Disconnect(_textEditorTextChangedCallbackDelegate);
+ }
+
+ if(_textEditorMaxLengthReachedCallbackDelegate != null)
+ {
+ this.MaxLengthReachedSignal().Disconnect(_textEditorMaxLengthReachedCallbackDelegate);
+ }
}
base.Dispose(type);
internal static readonly int PLACEHOLDER_TEXT_COLOR = Interop.TextEditor.TextEditor_Property_PLACEHOLDER_TEXT_COLOR_get();
internal static readonly int ENABLE_SHIFT_SELECTION = Interop.TextEditor.TextEditor_Property_ENABLE_SHIFT_SELECTION_get();
internal static readonly int MATCH_SYSTEM_LANGUAGE_DIRECTION = Interop.TextEditor.TextEditor_Property_MATCH_SYSTEM_LANGUAGE_DIRECTION_get();
+ internal static readonly int MAX_LENGTH = Interop.TextEditor.TextEditor_Property_MAX_LENGTH_get();
}
internal class InputStyle
Tizen.NUI.Object.GetProperty(textEditor.swigCPtr, TextEditor.Property.MATCH_SYSTEM_LANGUAGE_DIRECTION).Get(out temp);
return (bool)temp;
});
+ /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty MaxLengthProperty = BindableProperty.Create(nameof(MaxLength), typeof(int), typeof(TextEditor), default(int), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = (TextEditor)bindable;
+ if (newValue != null)
+ {
+ Tizen.NUI.Object.SetProperty(textEditor.swigCPtr, TextEditor.Property.MAX_LENGTH, new Tizen.NUI.PropertyValue((int)newValue));
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = (TextEditor)bindable;
+ int temp = 0;
+ Tizen.NUI.Object.GetProperty(textEditor.swigCPtr, TextEditor.Property.MAX_LENGTH).Get(out temp);
+ return temp;
+ });
}
}
*/
using System;
+using System.ComponentModel;
using System.Runtime.InteropServices;
namespace Tizen.NUI.BaseComponents
private EventHandler<ScrollStateChangedEventArgs> _textEditorScrollStateChangedEventHandler;
private ScrollStateChangedCallbackDelegate _textEditorScrollStateChangedCallbackDelegate;
+ private EventHandler<MaxLengthReachedEventArgs> _textEditorMaxLengthReachedEventHandler;
+ private MaxLengthReachedCallbackDelegate _textEditorMaxLengthReachedCallbackDelegate;
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void TextChangedCallbackDelegate(IntPtr textEditor);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void ScrollStateChangedCallbackDelegate(IntPtr textEditor, ScrollState state);
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void MaxLengthReachedCallbackDelegate(IntPtr textEditor);
+
/// <summary>
/// An event for the TextChanged signal which can be used to subscribe or unsubscribe the event handler
/// provided by the user. The TextChanged signal is emitted when the text changes.<br />
}
}
+ /// <summary>
+ /// The MaxLengthReached event.
+ /// </summary>
+ /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<MaxLengthReachedEventArgs> MaxLengthReached
+ {
+ add
+ {
+ if (_textEditorMaxLengthReachedEventHandler == null)
+ {
+ _textEditorMaxLengthReachedCallbackDelegate = (OnMaxLengthReached);
+ MaxLengthReachedSignal().Connect(_textEditorMaxLengthReachedCallbackDelegate);
+ }
+ _textEditorMaxLengthReachedEventHandler += value;
+ }
+ remove
+ {
+ if (_textEditorMaxLengthReachedEventHandler == null && MaxLengthReachedSignal().Empty() == false)
+ {
+ this.MaxLengthReachedSignal().Disconnect(_textEditorMaxLengthReachedCallbackDelegate);
+ }
+ _textEditorMaxLengthReachedEventHandler -= value;
+ }
+ }
+
internal TextEditorSignal TextChangedSignal()
{
TextEditorSignal ret = new TextEditorSignal(Interop.TextEditor.TextEditor_TextChangedSignal(swigCPtr), false);
return ret;
}
+ internal TextEditorSignal MaxLengthReachedSignal()
+ {
+ TextEditorSignal ret = new TextEditorSignal(Interop.TextEditor.TextEditor_MaxLengthReachedSignal(swigCPtr), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
private void OnTextChanged(IntPtr textEditor)
{
TextChangedEventArgs e = new TextChangedEventArgs();
}
}
+ private void OnMaxLengthReached(IntPtr textEditor)
+ {
+ MaxLengthReachedEventArgs e = new MaxLengthReachedEventArgs();
+
+ // Populate all members of "e" (MaxLengthReachedEventArgs) with real data
+ e.TextEditor = Registry.GetManagedBaseHandleFromNativePtr(textEditor) as TextEditor;
+
+ if (_textEditorMaxLengthReachedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _textEditorMaxLengthReachedEventHandler(this, e);
+ }
+ }
+
/// <summary>
/// Event arguments that passed via the TextChanged signal.
/// </summary>
}
}
}
+
+ /// <summary>
+ /// The MaxLengthReached event arguments.
+ /// </summary>
+ /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class MaxLengthReachedEventArgs : EventArgs
+ {
+ private TextEditor _textEditor;
+
+ /// <summary>
+ /// TextEditor.
+ /// </summary>
+ /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public TextEditor TextEditor
+ {
+ get
+ {
+ return _textEditor;
+ }
+ set
+ {
+ _textEditor = value;
+ }
+ }
+ }
}
}
editor.EnableSelection = true;
editor.Focusable = true;
editor.Placeholder = propertyMap;
+ editor.MaxLength = 10;
window.Add(editor);
editor.TextChanged += (obj, e) => {
Tizen.Log.Debug("NUI", "editor line count: " + e.TextEditor.LineCount);
editor.ScrollStateChanged += (obj, e)=> {
Tizen.Log.Debug("NUI", "editor scroll state:" + e.ScrollState);
};
+ editor.MaxLengthReached += (obj, e)=> {
+ Tizen.Log.Debug("NUI", "editor max length: "+ e.TextEditor.MaxLength);
+ };
Tizen.Log.Debug("NUI", "editor id: " + editor.ID);