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.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnPage.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; 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.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.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnPage.TabIndex = 9; this.btnPage.TabIndex = 9;
this.btnPage.Text = "Pa&ge"; this.btnPage.Text = "Page (F10)";
this.btnPage.Click += new System.EventHandler(this.btnPage_Click); this.btnPage.Click += new System.EventHandler(this.btnPage_Click);
// //
// btnPrev // btnPrev
// //
this.btnPrev.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; this.btnPrev.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnPrev.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; 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.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.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnPrev.TabIndex = 10; this.btnPrev.TabIndex = 10;
this.btnPrev.Text = "&Previous"; this.btnPrev.Text = "Previous (F11)";
this.btnPrev.Click += new System.EventHandler(this.btnPrev_Click); this.btnPrev.Click += new System.EventHandler(this.btnPrev_Click);
// //
// btnNext // btnNext
// //
this.btnNext.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; this.btnNext.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnNext.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; 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.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.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnNext.TabIndex = 11; this.btnNext.TabIndex = 11;
this.btnNext.Text = "&Next"; this.btnNext.Text = "Next (F12)";
this.btnNext.Click += new System.EventHandler(this.btnNext_Click); this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
// //
// ofd // ofd
@ -207,24 +210,26 @@
// //
this.btnNextIns.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; this.btnNextIns.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnNextIns.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; 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.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.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnNextIns.TabIndex = 12; this.btnNextIns.TabIndex = 12;
this.btnNextIns.Text = "Insert "; this.btnNextIns.Text = "Insert After (F4)";
this.btnNextIns.Click += new System.EventHandler(this.btnNextIns_Click); this.btnNextIns.Click += new System.EventHandler(this.btnNextIns_Click);
// //
// btnNextRpl // btnNextRpl
// //
this.btnNextRpl.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; this.btnNextRpl.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnNextRpl.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; 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.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.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnNextRpl.TabIndex = 13; this.btnNextRpl.TabIndex = 13;
this.btnNextRpl.Text = "Replace"; this.btnNextRpl.Text = "Replace After (F3)";
this.btnNextRpl.Click += new System.EventHandler(this.btnNextRpl_Click); this.btnNextRpl.Click += new System.EventHandler(this.btnNextRpl_Click);
// //
// frmImportWordContents // frmImportWordContents

View File

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