From bb584e042378360b40401934c6ed18b30c646b34 Mon Sep 17 00:00:00 2001 From: Fernando Cerqueira Date: Sun, 24 Sep 2023 18:04:49 -0300 Subject: [PATCH] Add AutoFill command --- Samples/TableBasicSamples/Program.cs | 33 +-- Src/Controls/Table/IControlTable.cs | 20 +- Src/Controls/Table/TableControl.cs | 288 +++++++++++++++++--- Src/Controls/Table/TableOptions.cs | 7 +- docs/apis/pplus.controls.icontroltable-1.md | 95 ++++--- 5 files changed, 338 insertions(+), 105 deletions(-) diff --git a/Samples/TableBasicSamples/Program.cs b/Samples/TableBasicSamples/Program.cs index 151226e..0b069b8 100644 --- a/Samples/TableBasicSamples/Program.cs +++ b/Samples/TableBasicSamples/Program.cs @@ -3,6 +3,7 @@ // The maintenance and evolution is maintained by the PromptPlus project under MIT license // *************************************************************************************** +using System.ComponentModel; using System.Globalization; using PPlus; using PPlus.Controls; @@ -38,7 +39,7 @@ static MyTable[] CreateItems() var result = new List(); var flag = false; result.Add(new MyTable { Id = 0, MyDate = new DateTime(), MyText = $"Test0 linha1{Environment.NewLine}Test3 linha2", ComplexCol = new MyComplexCol("C0") }); - for (int i = 1; i < 15; i++) + for (int i = 1; i < 19; i++) { flag = !flag; if (flag) @@ -65,22 +66,22 @@ static MyTable[] CreateItems() //.Default(data[1]) //.ChangeDescription((item,row,col) => $"{item.ComplexCol.Name}") //.PageSize(6) - .EnableColumnsNavigation() - .WithSeparatorRows() - .FilterByColumns(FilterMode.Contains, 1, 4) - .Layout(TableLayout.SingleGridFull) - .Title("Test", titleMode: TableTitleMode.InRow) + //.ColumnsNavigation() + //.SeparatorRows() + //.FilterByColumns(FilterMode.Contains, 1, 4) + //.Layout(TableLayout.SingleGridFull) + //.Title("Test", titleMode: TableTitleMode.InRow) .AddItems(data) .AddItem(new MyTable { Id = data.Length, MyText = $"Test{data.Length} disabled", ComplexCol = new MyComplexCol($"C{data.Length}") }, true) - .AddColumn(field: (item) => item.Id, width: 10) - .AddColumn(field: (item) => item.MyDate!, width: 15/*,alignment: Alignment.Center*/) - .AddColumn(field: (item) => item.MyText, width: 20, format: (arg) => $"Text: {arg}", maxslidinglines: 5/*, textcrop:true*/) - .AddColumn(field: (item) => item.ComplexCol, width: 20, format: (arg) => $"{((MyComplexCol)arg).Id}:{((MyComplexCol)arg).Name}") - .AddColumn(field: (item) => item.ComplexCol.Name, width: 10) + .AutoFill() + //.AddColumn(field: (item) => item.Id, width: 10) + //.AddColumn(field: (item) => item.MyDate!, width: 15/*,alignment: Alignment.Center*/) + //.AddColumn(field: (item) => item.MyText, width: 120, format: (arg) => $"Text: {arg}", maxslidinglines: 5/*, textcrop:true*/) + //.AddColumn(field: (item) => item.ComplexCol, width: 20, format: (arg) => $"{((MyComplexCol)arg).Id}:{((MyComplexCol)arg).Name}") + //.AddColumn(field: (item) => item.ComplexCol.Name, width: 10) //.AutoFit(1,2) .AddFormatType(FmtDate) - .AddFormatType(FmtInt) - .EnabledInteractionUser( + .UserInteraction( selectedTemplate: (item, row, col) => $"Current ID : {item.Id}. [yellow]Current row {row}, Current col {col}[/]", finishTemplate: (item, row, col) => $"[green]Selected ID : {item.Id}. Current row {row}, Current col {col}[/]") .Run(); @@ -91,12 +92,6 @@ static MyTable[] CreateItems() Console.ReadKey(); } - private static string FmtInt(object arg) - { - var value = (int)arg; - return value.ToString(); - } - private static string FmtDate(object arg) { var value = (DateTime)arg; diff --git a/Src/Controls/Table/IControlTable.cs b/Src/Controls/Table/IControlTable.cs index 77a83d0..c0e4b59 100644 --- a/Src/Controls/Table/IControlTable.cs +++ b/Src/Controls/Table/IControlTable.cs @@ -47,7 +47,7 @@ public interface IControlTable : IPromptControls> where T : cl IControlTable Interaction(IEnumerable values, Action, T1> action); /// - /// Set max.item view per page.Default value for this control is 5. + /// Set max.item view per page.Default value for this control is 10. /// /// Number of Max.rows /// @@ -157,11 +157,23 @@ public interface IControlTable : IPromptControls> where T : cl /// IControlTable AddColumn(Expression < Func> field, ushort width, Func format = null,Alignment alignment = Alignment.Left, string? title = null, Alignment titlealignment = Alignment.Center,bool titlereplaceswidth = true, bool textcrop = false, int? maxslidinglines = null); + /// + /// Auto generate Columns + ///
Header alignment will always be 'Center'
+ ///
The content alignment will always be 'Left'
+ ///
The content will always be with sliding lines
+ ///
Columns are generated by the public properties of the data class recognized by .
+ ///
TypeCode.DBNull and TypeCode.Object will be ignored.
+ ///
The table size will automatically adjust according to the size of the column content to the width of the screen
+ ///
+ /// + IControlTable AutoFill(); + /// /// Set separator between rows. Default none. /// /// - IControlTable WithSeparatorRows(); + IControlTable SeparatorRows(); /// /// Hide columns headers. Default false. @@ -206,13 +218,13 @@ public interface IControlTable : IPromptControls> where T : cl /// /// True not write table, otherwise write last state of table /// - IControlTable EnabledInteractionUser(Func selectedTemplate = null, Func finishTemplate = null, bool removetable = true); + IControlTable UserInteraction(Func selectedTemplate = null, Func finishTemplate = null, bool removetable = true); /// /// Enable Columns Navigation. Default, Rows Navigation. /// /// - IControlTable EnableColumnsNavigation(); + IControlTable ColumnsNavigation(); } } diff --git a/Src/Controls/Table/TableControl.cs b/Src/Controls/Table/TableControl.cs index a91abfa..78f876f 100644 --- a/Src/Controls/Table/TableControl.cs +++ b/Src/Controls/Table/TableControl.cs @@ -26,6 +26,8 @@ internal class TableControl : BaseControl>, IControlTable w private int _currentrow = -1; private int _currentcol = -1; private int _totalTableLenWidth; + private ushort[] _maxlencontentcols; + private int? _oldBufferWidth; public TableControl(IConsoleControl console, TableOptions options) : base(console, options) { @@ -94,7 +96,25 @@ public override string InitControl(CancellationToken cancellationToken) } } - //Calculate Table Length + if (_options.AutoFill) + { + //Calculate max content Length + _maxlencontentcols = new ushort[_options.Columns.Count]; + + foreach (var item in _options.Items.Select(x => x.Value)) + { + for (int i = 0; i < _options.Columns.Count; i++) + { + var text = GetTextColumn(item, _options.Columns[i].Field, _options.Columns[i].Format); + var lentext = text.NormalizeNewLines().Split(Environment.NewLine).Max(x => x.Length); + if (_maxlencontentcols[i] < lentext) + { + _maxlencontentcols[i] = (ushort)lentext; + } + } + } + } + _totalTableLenWidth = _options.Columns.Count + 1 + _options.Columns.Sum(x => x.OriginalWidth); if (!string.IsNullOrEmpty(_options.OverwriteDefaultFrom)) @@ -205,32 +225,25 @@ public override void FinalizeControl(CancellationToken cancellationToken) public override void InputTemplate(ScreenBuffer screenBuffer) { - //Calculate Table Length again when set autofit - if (_options.HasAutoFit) + if (_options.AutoFill && ((_oldBufferWidth??0) != ConsolePlus.BufferWidth)) { + _oldBufferWidth = ConsolePlus.BufferWidth; for (ushort i = 0; i < _options.Columns.Count; i++) { _options.Columns[i].Width = _options.Columns[i].OriginalWidth; } _totalTableLenWidth = _options.Columns.Count + 1 + _options.Columns.Sum(x => x.OriginalWidth); - if (_totalTableLenWidth < ConsolePlus.BufferWidth - 1) + var diff = ConsolePlus.BufferWidth - 1 - _totalTableLenWidth; + do { - var diff = ConsolePlus.BufferWidth - 1 - _totalTableLenWidth; - do + if (diff > 0) { + var haschange = false; for (ushort i = 0; i < _options.Columns.Count; i++) { - ushort index = i; - if (i == 0 && !_options.HideSelectorRow) - { - continue; - } - if (!_options.HideSelectorRow) - { - index--; - } - if (_options.AutoFitColumns.Length == 0 || _options.AutoFitColumns.Contains(index)) + if (_options.Columns[i].Width+1 <= _maxlencontentcols[i]) { + haschange = true; _options.Columns[i].Width++; diff--; } @@ -239,9 +252,54 @@ public override void InputTemplate(ScreenBuffer screenBuffer) break; } } + if (!haschange) + { + diff = 0; + } + } + } while (diff > 0); + _totalTableLenWidth = _options.Columns.Count + 1 + _options.Columns.Sum(x => x.Width); + } + else + { + //Calculate Table Length again when set autofit + if (_options.HasAutoFit) + { + for (ushort i = 0; i < _options.Columns.Count; i++) + { + _options.Columns[i].Width = _options.Columns[i].OriginalWidth; + } + _totalTableLenWidth = _options.Columns.Count + 1 + _options.Columns.Sum(x => x.OriginalWidth); + var diff = ConsolePlus.BufferWidth - 1 - _totalTableLenWidth; + do + { + if (diff > 0) + { + for (ushort i = 0; i < _options.Columns.Count; i++) + { + ushort index = i; + if (i == 0 && !_options.HideSelectorRow) + { + continue; + } + if (!_options.HideSelectorRow) + { + index--; + } + if (_options.AutoFitColumns.Length == 0 || _options.AutoFitColumns.Contains(index)) + { + _options.Columns[i].Width++; + diff--; + } + if (diff == 0) + { + break; + } + } + } } while (diff > 0); + _totalTableLenWidth = _options.Columns.Count + 1 + _options.Columns.Sum(x => x.Width); } - _totalTableLenWidth = _options.Columns.Count + 1 + _options.Columns.Sum(x => x.Width); } if (!_options.IsInteraction) @@ -439,8 +497,68 @@ public override ResultPrompt> TryResult(CancellationToken cancell #region IControlTable + public IControlTable AutoFill() + { + if (_options.Columns.Count > 0) + { + throw new PromptPlusException($"AutoFill cannot be run with AddColumn"); + } + _options.AutoFill = true; + var colpropInfo = typeof(T).GetProperties(); + for (int i = 0; i < colpropInfo.Length; i++) + { + var tc = Type.GetTypeCode(colpropInfo[i].PropertyType); + var isvalid = true; + if (isvalid && tc == TypeCode.Object) + { + isvalid = !colpropInfo[i].PropertyType.IsClass; + if (isvalid && Nullable.GetUnderlyingType(colpropInfo[i].PropertyType) != null) + { + var aux = Type.GetTypeCode(Nullable.GetUnderlyingType(colpropInfo[i].PropertyType)); + if (aux == TypeCode.Object || aux == TypeCode.DBNull) + { + isvalid = false; + } + } + } + else if (tc == TypeCode.DBNull) + { + isvalid = false; + } + if (isvalid) + { + var tit = $" {(colpropInfo[i].Name ?? string.Empty).Trim()}"; + if (tit.Length > byte.MaxValue) + { + tit = tit[..byte.MaxValue]; + } + + _options.Columns.Add(new ItemItemColumn() + { + AlignCol = Alignment.Left, + Field = Generate(colpropInfo[i].Name).Compile(), + Format = null, + Width = (ushort)tit.Trim().Length, + OriginalWidth = (ushort)tit.Trim().Length, + TextCrop = false, + Title = tit, + AlignTitle = Alignment.Center, + MaxSlidingLines = null, + TitleReplacesWidth = true + }); + } + } + + return this; + } + public IControlTable AddColumn(Expression> field, ushort width, Func format = null, Alignment alignment = Alignment.Left, string? title = null, Alignment titlealignment = Alignment.Center, bool titlereplaceswidth = true, bool textcrop = false, int? maxslidinglines = null) { + if (_options.AutoFill) + { + throw new PromptPlusException($"AddColumn cannot be run with AutoFill"); + } + if (maxslidinglines.HasValue) { if (maxslidinglines.Value <= 0) @@ -537,6 +655,10 @@ public IControlTable AddItemsTo(AdderScope scope, params T[] values) public IControlTable AutoFit(params ushort[] indexColumn) { + if (_options.AutoFill) + { + throw new PromptPlusException($"AutoFit cannot be run with AutoFill"); + } _options.HasAutoFit = true; _options.AutoFitColumns = indexColumn; return this; @@ -566,13 +688,13 @@ public IControlTable Default(T value) return this; } - public IControlTable EnableColumnsNavigation() + public IControlTable ColumnsNavigation() { _options.IsColumnsNavigation = true; return this; } - public IControlTable EnabledInteractionUser(Func selectedTemplate = null, Func finishTemplate = null, bool removetable = true) + public IControlTable UserInteraction(Func selectedTemplate = null, Func finishTemplate = null, bool removetable = true) { _options.IsInteraction = true; _options.SelectedTemplate = selectedTemplate; @@ -652,9 +774,9 @@ public IControlTable PageSize(int value) return this; } - public IControlTable WithSeparatorRows() + public IControlTable SeparatorRows() { - _options.WithSeparatorRows = true; + _options.SeparatorRows = true; return this; } @@ -702,6 +824,13 @@ public IControlTable Title(string value, Alignment alignment = Alignment.Cent #endregion + private static Expression> Generate(string property_name) + { + var parameter = Expression.Parameter(typeof(T)); + + return Expression.Lambda>( + Expression.Convert(Expression.Property(parameter, property_name), typeof(object)), parameter); + } private static string GetNameUnaryExpression(Expression> exp) { if (exp.Body is not MemberExpression body) @@ -743,10 +872,10 @@ private static string AlignmentText(string value, Alignment alignment, int maxle private void BuildLineColumn(ScreenBuffer screenBuffer,char startln,char sepln, char endln, char contentln) { - var stl = _options.GridStyle.Overflow(Overflow.Crop); + var stl = _options.GridStyle; if ( _options.Layout == TableLayout.HideGrid) { - stl = Style.Default.Overflow(Overflow.Crop); + stl = Style.Default; } screenBuffer.AddBuffer($"{startln}{new string(contentln, _options.Columns[0].Width)}", stl); foreach (var item in _options.Columns.Skip(1)) @@ -906,11 +1035,92 @@ private void WriteTableTitle(ScreenBuffer screenBuffer) { if (string.IsNullOrEmpty(tit)) { + screenBuffer.NewLine(); + switch (_options.Layout) + { + case TableLayout.HideGrid: + BuildLineColumn(screenBuffer, ' ', ' ', ' ', ' '); + break; + case TableLayout.SingleGridFull: + case TableLayout.SingleGridSoft: + if (_options.HideHeaders) + { + if (_options.Layout == TableLayout.SingleGridFull) + { + BuildLineColumn(screenBuffer, '┌', '┬', '┐', '─'); + } + else + { + BuildLineColumn(screenBuffer, '┌', '─', '┐', '─'); + } + } + else + { + BuildLineColumn(screenBuffer, '┌', '┬', '┐', '─'); + } + break; + case TableLayout.DoubleGridFull: + case TableLayout.DoubleGridSoft: + if (_options.HideHeaders) + { + if (_options.Layout == TableLayout.DoubleGridFull) + { + BuildLineColumn(screenBuffer, '╔', '╦', '╗', '═'); + } + else + { + BuildLineColumn(screenBuffer, '╔', '═', '╗', '═'); + } + } + else + { + BuildLineColumn(screenBuffer, '╔', '╦', '╗', '═'); + } + break; + case TableLayout.AsciiSingleGridFull: + case TableLayout.AsciiSingleGridSoft: + if (_options.HideHeaders) + { + if (_options.Layout == TableLayout.AsciiSingleGridFull) + { + BuildLineColumn(screenBuffer, '+', '+', '+', '-'); + } + else + { + BuildLineColumn(screenBuffer, '+', '-', '+', '-'); + } + } + else + { + BuildLineColumn(screenBuffer, '+', '+', '+', '-'); + } + break; + case TableLayout.AsciiDoubleGridFull: + case TableLayout.AsciiDoubleGridSoft: + if (_options.HideHeaders) + { + if (_options.Layout == TableLayout.AsciiDoubleGridFull) + { + BuildLineColumn(screenBuffer, '+', '+', '+', '='); + } + else + { + BuildLineColumn(screenBuffer, '+', '=', '+', '='); + } + } + else + { + BuildLineColumn(screenBuffer, '+', '+', '+', '='); + } + break; + default: + throw new PromptPlusException($"Layout {_options.Layout} Not implemented"); + } return; } screenBuffer.NewLine(); tit = TableControl.AlignmentText(tit, _options.TitleAlignment, _totalTableLenWidth); - screenBuffer.AddBuffer(tit, _options.TitleStyle.Overflow(Overflow.Crop)); + screenBuffer.AddBuffer(tit, _options.TitleStyle); tit = string.Empty; } WriteTopTable(screenBuffer); @@ -946,9 +1156,9 @@ private void WriteTitleInRow(string tit, ScreenBuffer screenBuffer) default: throw new PromptPlusException($"Layout {_options.Layout} Not implemented"); } - screenBuffer.AddBuffer(sep, _options.GridStyle.Overflow(Overflow.Crop)); - screenBuffer.AddBuffer(tit, _options.TitleStyle.Overflow(Overflow.Crop)); - screenBuffer.AddBuffer(sep, _options.GridStyle.Overflow(Overflow.Crop)); + screenBuffer.AddBuffer(sep, _options.GridStyle); + screenBuffer.AddBuffer(tit, _options.TitleStyle); + screenBuffer.AddBuffer(sep, _options.GridStyle); screenBuffer.NewLine(); switch (_options.Layout) @@ -1154,11 +1364,11 @@ private void WriteTableHeader(ScreenBuffer screenBuffer) var col = -1; var sepstart = " "; var sepend = " "; - var stl = _options.GridStyle.Overflow(Overflow.Crop); + var stl = _options.GridStyle; switch (_options.Layout) { case TableLayout.HideGrid: - stl = Style.Default.Overflow(Overflow.Crop); + stl = Style.Default; break; case TableLayout.SingleGridFull: case TableLayout.SingleGridSoft: @@ -1185,12 +1395,12 @@ private void WriteTableHeader(ScreenBuffer screenBuffer) if (_options.IsColumnsNavigation && _options.IsInteraction && col == _currentcol) { var h = TableControl.AlignmentText($"{_options.Symbol(SymbolType.Selector)} {item.Title.Trim()}", item.AlignTitle, item.Width); - screenBuffer.AddBuffer(h, _options.SelectedColHeader.Overflow(Overflow.Crop)); + screenBuffer.AddBuffer(h, _options.SelectedColHeader); } else { var h = TableControl.AlignmentText(item.Title.Trim(), item.AlignTitle, item.Width); - screenBuffer.AddBuffer(h, _options.HeaderStyle.Overflow(Overflow.Crop)); + screenBuffer.AddBuffer(h, _options.HeaderStyle); } } screenBuffer.AddBuffer(sepend, stl); @@ -1258,11 +1468,11 @@ private void WriteTableRows(ScreenBuffer screenBuffer) var sep = " "; var sepcol = " "; - var stl = _options.GridStyle.Overflow(Overflow.Crop); + var stl = _options.GridStyle; switch (_options.Layout) { case TableLayout.HideGrid: - stl = Style.Default.Overflow(Overflow.Crop); + stl = Style.Default; break; case TableLayout.SingleGridFull: sep = "│"; @@ -1323,24 +1533,24 @@ private void WriteTableRows(ScreenBuffer screenBuffer) { if (itemcol == _currentcol || !_options.HideSelectorRow && itemcol == 0) { - screenBuffer.AddBuffer(col, _options.SelectedContentStyle.Overflow(Overflow.Crop), true); + screenBuffer.AddBuffer(col, _options.SelectedContentStyle, true); } else { - screenBuffer.AddBuffer(col, _options.ContentStyle.Overflow(Overflow.Crop), true); + screenBuffer.AddBuffer(col, _options.ContentStyle, true); } } else { - screenBuffer.AddBuffer(col, _options.SelectedContentStyle.Overflow(Overflow.Crop), true); + screenBuffer.AddBuffer(col, _options.SelectedContentStyle, true); } } else { - var stld = _options.ContentStyle.Overflow(Overflow.Crop); + var stld = _options.ContentStyle; if (isdisabled) { - stld = _options.DisabledContentStyle.Overflow(Overflow.Crop); + stld = _options.DisabledContentStyle; } screenBuffer.AddBuffer(col, stld, true); } @@ -1352,7 +1562,7 @@ private void WriteTableRows(ScreenBuffer screenBuffer) } } - if (_options.WithSeparatorRows && pos < subset.Count) + if (_options.SeparatorRows && pos < subset.Count) { screenBuffer.NewLine(); switch (_options.Layout) diff --git a/Src/Controls/Table/TableOptions.cs b/Src/Controls/Table/TableOptions.cs index 200e6cd..2d74257 100644 --- a/Src/Controls/Table/TableOptions.cs +++ b/Src/Controls/Table/TableOptions.cs @@ -19,7 +19,7 @@ private TableOptions() : base(null, null, null, true) internal TableOptions(StyleSchema styleSchema, ConfigControls config, IConsoleControl console, bool showcursor) : base(styleSchema, config, console, showcursor) { TimeoutOverwriteDefault = config.HistoryTimeout; - PageSize = 5; + PageSize = config.PageSize; GridStyle = styleSchema.Prompt(); HeaderStyle = styleSchema.Prompt(); SelectedColHeader = styleSchema.Selected(); @@ -84,7 +84,7 @@ internal TableOptions(StyleSchema styleSchema, ConfigControls config, IConsoleCo public bool HideHeaders { get; set; } - public bool WithSeparatorRows { get; set; } + public bool SeparatorRows { get; set; } public bool HasAutoFit{ get; set; } @@ -103,5 +103,8 @@ internal TableOptions(StyleSchema styleSchema, ConfigControls config, IConsoleCo public Func ChangeDescription { get; set; } public bool RemoveTableAtFinish { get; set; } = true; + + public bool AutoFill { get; set; } + } } diff --git a/docs/apis/pplus.controls.icontroltable-1.md b/docs/apis/pplus.controls.icontroltable-1.md index 7cf16b8..7bcb9a1 100644 --- a/docs/apis/pplus.controls.icontroltable-1.md +++ b/docs/apis/pplus.controls.icontroltable-1.md @@ -149,6 +149,19 @@ items colletion [IControlTable<T>](./pplus.controls.icontroltable-1.md) +### **AutoFill()** + +Auto generate Columns +
Header alignment will always be 'Center'
The content alignment will always be 'Left'
The content will always be with sliding lines
Columns are generated by the public properties of the data class recognized by .
TypeCode.DBNull and TypeCode.Object will be ignored.
The table size will automatically adjust according to the size of the column content to the width of the screen + +```csharp +IControlTable AutoFill() +``` + +#### Returns + +[IControlTable<T>](./pplus.controls.icontroltable-1.md) + ###
**AutoFit(params UInt16[])** Set the grid to auto-resize to current console width @@ -185,6 +198,18 @@ function to apply change [IControlTable<T>](./pplus.controls.icontroltable-1.md) +### **ColumnsNavigation()** + +Enable Columns Navigation. Default, Rows Navigation. + +```csharp +IControlTable ColumnsNavigation() +``` + +#### Returns + +[IControlTable<T>](./pplus.controls.icontroltable-1.md) + ### **Config(Action<IPromptConfig>)** Custom config the control. @@ -219,43 +244,6 @@ Value default [IControlTable<T>](./pplus.controls.icontroltable-1.md) -### **EnableColumnsNavigation()** - -Enable Columns Navigation. Default, Rows Navigation. - -```csharp -IControlTable EnableColumnsNavigation() -``` - -#### Returns - -[IControlTable<T>](./pplus.controls.icontroltable-1.md) - -### **EnabledInteractionUser(Func<T, Int32, Int32, String>, Func<T, Int32, Int32, String>, Boolean)** - -Wait Select row with [enter].Default not wait (only display all rows) - -```csharp -IControlTable EnabledInteractionUser(Func selectedTemplate, Func finishTemplate, bool removetable) -``` - -#### Parameters - -`selectedTemplate` Func<T, Int32, Int32, String>
-message template function when selected item. -
Func(T, int, int, string) = T = item, int = current row (base0) , int = current col (base0) - -`finishTemplate` Func<T, Int32, Int32, String>
-message template function when finish control with seleted item -
Func(T, int, int, string) = T = item, int = current row (base0) , int = current col (base0) - -`removetable` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
-True not write table, otherwise write last state of table - -#### Returns - -[IControlTable<T>](./pplus.controls.icontroltable-1.md) - ###
**EqualItems(Func<T, T, Boolean>)** Custom item comparator @@ -415,7 +403,7 @@ The timeout for valid items saved. Default value is 365 days ### **PageSize(Int32)** -Set max.item view per page.Default value for this control is 5. +Set max.item view per page.Default value for this control is 10. ```csharp IControlTable PageSize(int value) @@ -430,6 +418,18 @@ Number of Max.rows [IControlTable<T>](./pplus.controls.icontroltable-1.md) +### **SeparatorRows()** + +Set separator between rows. Default none. + +```csharp +IControlTable SeparatorRows() +``` + +#### Returns + +[IControlTable<T>](./pplus.controls.icontroltable-1.md) + ### **Styles(TableStyle, Style)** Styles for Table elements @@ -473,14 +473,27 @@ InLine: Write the title above the grid. InRow : Write the title inside the grid [IControlTable<T>](./pplus.controls.icontroltable-1.md) -### **WithSeparatorRows()** +### **UserInteraction(Func<T, Int32, Int32, String>, Func<T, Int32, Int32, String>, Boolean)** -Set separator between rows. Default none. +Wait Select row with [enter].Default not wait (only display all rows) ```csharp -IControlTable WithSeparatorRows() +IControlTable UserInteraction(Func selectedTemplate, Func finishTemplate, bool removetable) ``` +#### Parameters + +`selectedTemplate` Func<T, Int32, Int32, String>
+message template function when selected item. +
Func(T, int, int, string) = T = item, int = current row (base0) , int = current col (base0) + +`finishTemplate` Func<T, Int32, Int32, String>
+message template function when finish control with seleted item +
Func(T, int, int, string) = T = item, int = current row (base0) , int = current col (base0) + +`removetable` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
+True not write table, otherwise write last state of table + #### Returns [IControlTable<T>](./pplus.controls.icontroltable-1.md)