Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Fix Event TextChanged in TextCellView in ListView #526 #570

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Xwt.Gtk/Xwt.GtkBackend.CellViews/CustomCellRendererText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void HandleEdited (object o, EditedArgs args)
SetCurrentEventRow ();
var view = (ITextCellViewFrontend) Frontend;

if (!view.RaiseTextChanged () && view.TextField != null) {
if (!view.RaiseTextChanged (args.NewText) && view.TextField != null) {
Gtk.TreeIter iter;
if (TreeModel.GetIterFromString (out iter, args.Path))
CellUtil.SetModelValue (TreeModel, iter, view.TextField.Index, view.TextField.FieldType, args.NewText);
Expand Down
2 changes: 1 addition & 1 deletion Xwt/Xwt.Backends/ITextCellViewFrontend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public interface ITextCellViewFrontend: ICellViewFrontend
bool Editable { get; }
EllipsizeMode Ellipsize { get; }

bool RaiseTextChanged ();
bool RaiseTextChanged (string text);

IDataField TextField { get; set; }
}
Expand Down
3 changes: 2 additions & 1 deletion Xwt/Xwt/TextCellView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ public EllipsizeMode Ellipsize {
/// </summary>
public event EventHandler<WidgetEventArgs> TextChanged;

bool ITextCellViewFrontend.RaiseTextChanged ()
bool ITextCellViewFrontend.RaiseTextChanged (string newValue)
{
if (TextChanged != null) {
var args = new WidgetEventArgs ();
args.Text = newValue;
TextChanged (this, args);
return args.Handled;
}
Expand Down
2 changes: 2 additions & 0 deletions Xwt/Xwt/WidgetEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public class WidgetEventArgs: EventArgs
/// <value><c>true</c> if handled; otherwise, <c>false</c>.</value>
/// <remarks>This property can be set to <c>true</c> to prevent the execution of the default handler of the event</remarks>
public bool Handled { get; set; }

public string Text { get; set; }
}
}