Double clicking on template item adds it to the template.
This commit is contained in:
parent
3a48479435
commit
7fafee804d
4 changed files with 33 additions and 21 deletions
|
|
@ -103,13 +103,16 @@
|
|||
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.columnHeader1,
|
||||
this.columnHeader2});
|
||||
this.listView1.HideSelection = false;
|
||||
this.listView1.FullRowSelect = true;
|
||||
this.listView1.GridLines = true;
|
||||
this.listView1.Location = new System.Drawing.Point(12, 56);
|
||||
this.listView1.MultiSelect = false;
|
||||
this.listView1.Name = "listView1";
|
||||
this.listView1.Size = new System.Drawing.Size(328, 283);
|
||||
this.listView1.TabIndex = 3;
|
||||
this.listView1.UseCompatibleStateImageBehavior = false;
|
||||
this.listView1.View = System.Windows.Forms.View.Details;
|
||||
this.listView1.DoubleClick += new System.EventHandler(this.listView1_DoubleClick);
|
||||
//
|
||||
// columnHeader1
|
||||
//
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using System.IO;
|
|||
using System.Windows.Forms;
|
||||
using Dinah.Core;
|
||||
using LibationFileManager;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace LibationWinForms.Dialogs
|
||||
{
|
||||
|
|
@ -59,7 +60,7 @@ namespace LibationWinForms.Dialogs
|
|||
|
||||
// populate list view
|
||||
foreach (var tag in template.GetTemplateTags())
|
||||
listView1.Items.Add(new ListViewItem(new[] { $"<{tag.TagName}>", tag.Description }));
|
||||
listView1.Items.Add(new System.Windows.Forms.ListViewItem(new[] { $"<{tag.TagName}>", tag.Description }));
|
||||
}
|
||||
|
||||
private void resetToDefaultBtn_Click(object sender, EventArgs e) => resetTextBox(template.DefaultTemplate);
|
||||
|
|
@ -197,5 +198,16 @@ namespace LibationWinForms.Dialogs
|
|||
this.DialogResult = DialogResult.Cancel;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void listView1_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
var item = listView1.SelectedItems[0];
|
||||
var text = templateTb.Text;
|
||||
|
||||
var selStart = Math.Min(Math.Max(0, templateTb.SelectionStart), text.Length);
|
||||
|
||||
templateTb.Text = text.Insert(selStart, item.Text);
|
||||
templateTb.SelectionStart = selStart + item.Text.Length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue