Added shortcut keys for the buttons

This commit is contained in:
John Jenko 2016-03-16 15:08:34 +00:00
parent c668bbaca6
commit ba019e4476
2 changed files with 28 additions and 30 deletions

View File

@ -166,36 +166,39 @@
//
this.btnPage.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnPage.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnPage.Location = new System.Drawing.Point(470, 84);
this.btnPage.Location = new System.Drawing.Point(461, 84);
this.btnPage.Name = "btnPage";
this.btnPage.Size = new System.Drawing.Size(75, 23);
this.btnPage.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.F10);
this.btnPage.Size = new System.Drawing.Size(84, 23);
this.btnPage.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnPage.TabIndex = 9;
this.btnPage.Text = "Pa&ge";
this.btnPage.Text = "Page (F10)";
this.btnPage.Click += new System.EventHandler(this.btnPage_Click);
//
// btnPrev
//
this.btnPrev.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnPrev.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnPrev.Location = new System.Drawing.Point(470, 116);
this.btnPrev.Location = new System.Drawing.Point(461, 116);
this.btnPrev.Name = "btnPrev";
this.btnPrev.Size = new System.Drawing.Size(75, 23);
this.btnPrev.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.F11);
this.btnPrev.Size = new System.Drawing.Size(84, 23);
this.btnPrev.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnPrev.TabIndex = 10;
this.btnPrev.Text = "&Previous";
this.btnPrev.Text = "Previous (F11)";
this.btnPrev.Click += new System.EventHandler(this.btnPrev_Click);
//
// btnNext
//
this.btnNext.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnNext.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnNext.Location = new System.Drawing.Point(470, 145);
this.btnNext.Location = new System.Drawing.Point(461, 145);
this.btnNext.Name = "btnNext";
this.btnNext.Size = new System.Drawing.Size(75, 23);
this.btnNext.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.F12);
this.btnNext.Size = new System.Drawing.Size(84, 23);
this.btnNext.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnNext.TabIndex = 11;
this.btnNext.Text = "&Next";
this.btnNext.Text = "Next (F12)";
this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
//
// ofd
@ -207,24 +210,26 @@
//
this.btnNextIns.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnNextIns.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnNextIns.Location = new System.Drawing.Point(380, 200);
this.btnNextIns.Location = new System.Drawing.Point(353, 200);
this.btnNextIns.Name = "btnNextIns";
this.btnNextIns.Size = new System.Drawing.Size(75, 20);
this.btnNextIns.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.F4);
this.btnNextIns.Size = new System.Drawing.Size(102, 20);
this.btnNextIns.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnNextIns.TabIndex = 12;
this.btnNextIns.Text = "Insert ";
this.btnNextIns.Text = "Insert After (F4)";
this.btnNextIns.Click += new System.EventHandler(this.btnNextIns_Click);
//
// btnNextRpl
//
this.btnNextRpl.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnNextRpl.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnNextRpl.Location = new System.Drawing.Point(380, 174);
this.btnNextRpl.Location = new System.Drawing.Point(353, 174);
this.btnNextRpl.Name = "btnNextRpl";
this.btnNextRpl.Size = new System.Drawing.Size(75, 20);
this.btnNextRpl.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.F3);
this.btnNextRpl.Size = new System.Drawing.Size(102, 20);
this.btnNextRpl.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnNextRpl.TabIndex = 13;
this.btnNextRpl.Text = "Replace";
this.btnNextRpl.Text = "Replace After (F3)";
this.btnNextRpl.Click += new System.EventHandler(this.btnNextRpl_Click);
//
// frmImportWordContents

View File

@ -30,6 +30,8 @@ namespace Volian.Controls.Library
_initializing = false;
btnOpen.Enabled = (txbWordFile.Text.Length > 0);
}
private void disableButtons()
{
btnOpen.Enabled = false;
@ -42,7 +44,6 @@ namespace Volian.Controls.Library
_initializing = true;
txbWordFile.Text = ofd.FileName;
_initializing = false;
//btnOpen.Enabled = true;
}
private void btnBrowse_Click(object sender, EventArgs e)
@ -64,7 +65,6 @@ namespace Volian.Controls.Library
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
btnOpen_Click(sender, e);
// btnOpen.PerformClick(); // does not work if button is disabled
}
}
@ -98,7 +98,6 @@ namespace Volian.Controls.Library
_WordApp.Selection.MoveUp(LBWdUnits.wdParagraph, 1, 1);
try
{
//int idx = _WordApp.Selection.Text.IndexOfAny("\t".ToCharArray());
int idx = -1;
if (_WordApp.Selection.Text.EndsWith("\t(\r") || _WordApp.Selection.Text.EndsWith("\t___\r"))
idx = _WordApp.Selection.Text.LastIndexOf("\t");
@ -110,7 +109,6 @@ namespace Volian.Controls.Library
txbWrdText.Text = txbWrdText.Text.Replace('\x0B', ' '); // replace hard return with regular space
txvStyle.Text = _WordApp.Selection.Style.NameLocal;
txbLevel.Text = _WordApp.Selection.Style.ListLevelNumber.ToString();
//_WordApp.Selection.Copy();
Clipboard.SetText(txbWrdText.Text);
}
catch
@ -123,7 +121,6 @@ namespace Volian.Controls.Library
_WordApp.Selection.MoveDown(LBWdUnits.wdParagraph, 1, 1);
try
{
//int idx = _WordApp.Selection.Text.IndexOfAny("\t".ToCharArray());
int idx = -1;
if (_WordApp.Selection.Text.EndsWith("\t(\r") || _WordApp.Selection.Text.EndsWith("\t___\r"))
idx = _WordApp.Selection.Text.LastIndexOf("\t");
@ -137,17 +134,10 @@ namespace Volian.Controls.Library
txvStyle.Text = _WordApp.Selection.Style.NameLocal;
txbLevel.Text = _WordApp.Selection.Style.ListLevelNumber.ToString();
//_WordApp.Selection.Copy();
Clipboard.SetText(txbWrdText.Text);
}
catch
{ }
//string tmp = Clipboard.GetText(TextDataFormat.Html);
//if (MyStepRTB != null)
//{
// MyStepRTB.RtbSendKeys("^+i");
// MyStepRTB.RtbSendKeys("^v");
//}
}
private void txbWordFile_TextChanged(object sender, EventArgs e)
@ -170,28 +160,31 @@ namespace Volian.Controls.Library
private void btnNextIns_Click(object sender, EventArgs e)
{
//btnNext_Click(sender, e);
if (MyStepRTB != null)
{
if (MyStepRTB.MyItemInfo.IsSection)
{
MyStepRTB.RtbSendKeys("^{DOWN}"); // down arrow
MyStepRTB.RtbSendKeys("^{DOWN}"); // <Ctrl><down arrow> - next edit window
MyStepRTB.RtbSendKeys("^+b"); // insert previous
}
else
MyStepRTB.RtbSendKeys("^+i"); // insert next (same type and level)
MyStepRTB.RtbSendKeys("^v"); // clipboard paste
Application.DoEvents();
}
this.Focus(); // set focus back to this form
}
private void btnNextRpl_Click(object sender, EventArgs e)
{
if (MyStepRTB != null)
{
MyStepRTB.RtbSendKeys("^{DOWN}"); // move to next edit window
MyStepRTB.RtbSendKeys("^{DOWN}"); // <Ctrl><down arrow> - next edit window
MyStepRTB.RtbSendKeys("^a"); // select all
MyStepRTB.RtbSendKeys("^v"); // clipboard paste
Application.DoEvents();
}
this.Focus(); // set focus back to this form
}
}
}