From ab9b014162442514c31bd79c720263c600f1d818 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Sat, 2 Jul 2022 23:02:34 +0000 Subject: [PATCH] --- AyaNovaQBI/Map.Designer.cs | 65 +++++++++++++++++++++----------------- AyaNovaQBI/Map.cs | 40 +++++++++++++++-------- 2 files changed, 62 insertions(+), 43 deletions(-) diff --git a/AyaNovaQBI/Map.Designer.cs b/AyaNovaQBI/Map.Designer.cs index 8beff74..0fc1c83 100644 --- a/AyaNovaQBI/Map.Designer.cs +++ b/AyaNovaQBI/Map.Designer.cs @@ -28,10 +28,10 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.objectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.customersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -72,10 +72,10 @@ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.objectToolStripMenuItem, this.showToolStripMenuItem, - this.autoLinkToolStripMenuItem, - this.updateAyaNovaPricesToolStripMenuItem, this.linkSelectedItemsToolStripMenuItem, - this.importSelectedItemsToolStripMenuItem}); + this.importSelectedItemsToolStripMenuItem, + this.autoLinkToolStripMenuItem, + this.updateAyaNovaPricesToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Size = new System.Drawing.Size(783, 24); @@ -91,11 +91,14 @@ this.partsToolStripMenuItem, this.vendorsToolStripMenuItem}); this.objectToolStripMenuItem.Name = "objectToolStripMenuItem"; - this.objectToolStripMenuItem.Size = new System.Drawing.Size(54, 20); - this.objectToolStripMenuItem.Text = "&Object"; + this.objectToolStripMenuItem.Size = new System.Drawing.Size(80, 20); + this.objectToolStripMenuItem.Text = "&Object type"; // // customersToolStripMenuItem // + this.customersToolStripMenuItem.Checked = true; + this.customersToolStripMenuItem.CheckOnClick = true; + this.customersToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.customersToolStripMenuItem.Name = "customersToolStripMenuItem"; this.customersToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.customersToolStripMenuItem.Text = "&Customers"; @@ -103,6 +106,7 @@ // // serviceRatesToolStripMenuItem // + this.serviceRatesToolStripMenuItem.CheckOnClick = true; this.serviceRatesToolStripMenuItem.Name = "serviceRatesToolStripMenuItem"; this.serviceRatesToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.serviceRatesToolStripMenuItem.Text = "&Service rates"; @@ -110,6 +114,7 @@ // // travelRatesToolStripMenuItem // + this.travelRatesToolStripMenuItem.CheckOnClick = true; this.travelRatesToolStripMenuItem.Name = "travelRatesToolStripMenuItem"; this.travelRatesToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.travelRatesToolStripMenuItem.Text = "&Travel rates"; @@ -117,6 +122,7 @@ // // partsToolStripMenuItem // + this.partsToolStripMenuItem.CheckOnClick = true; this.partsToolStripMenuItem.Name = "partsToolStripMenuItem"; this.partsToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.partsToolStripMenuItem.Text = "&Parts"; @@ -124,6 +130,7 @@ // // vendorsToolStripMenuItem // + this.vendorsToolStripMenuItem.CheckOnClick = true; this.vendorsToolStripMenuItem.Name = "vendorsToolStripMenuItem"; this.vendorsToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.vendorsToolStripMenuItem.Text = "&Vendors"; @@ -183,17 +190,17 @@ this.gridAya.AllowUserToAddRows = false; this.gridAya.AllowUserToDeleteRows = false; this.gridAya.AllowUserToResizeRows = false; - dataGridViewCellStyle5.BackColor = System.Drawing.Color.WhiteSmoke; - this.gridAya.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle9.BackColor = System.Drawing.Color.WhiteSmoke; + this.gridAya.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle9; this.gridAya.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; - dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.gridAya.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle6; + dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle10.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle10.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle10.SelectionBackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.gridAya.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10; this.gridAya.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.gridAya.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.AyaName, @@ -239,17 +246,17 @@ this.gridQB.AllowUserToAddRows = false; this.gridQB.AllowUserToDeleteRows = false; this.gridQB.AllowUserToResizeRows = false; - dataGridViewCellStyle7.BackColor = System.Drawing.Color.WhiteSmoke; - this.gridQB.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7; + dataGridViewCellStyle11.BackColor = System.Drawing.Color.WhiteSmoke; + this.gridQB.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11; this.gridQB.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; - dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle8.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.gridQB.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8; + dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle12.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.gridQB.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12; this.gridQB.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.gridQB.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.dataGridViewTextBoxColumn1, diff --git a/AyaNovaQBI/Map.cs b/AyaNovaQBI/Map.cs index 7347ad4..77993ba 100644 --- a/AyaNovaQBI/Map.cs +++ b/AyaNovaQBI/Map.cs @@ -317,8 +317,6 @@ namespace AyaNovaQBI - - private void showSubItemToolStripMenuItem_Click(object sender, EventArgs e) { // Set the current clicked item to item @@ -362,33 +360,47 @@ namespace AyaNovaQBI private void customersToolStripMenuItem_Click(object sender, EventArgs e) { - + handleCheckOfObjectTypeMenuItem(sender, e); } private void serviceRatesToolStripMenuItem_Click(object sender, EventArgs e) { - + handleCheckOfObjectTypeMenuItem(sender, e); } private void travelRatesToolStripMenuItem_Click(object sender, EventArgs e) { - + handleCheckOfObjectTypeMenuItem(sender, e); } private void partsToolStripMenuItem_Click(object sender, EventArgs e) { - + handleCheckOfObjectTypeMenuItem(sender, e); } private void vendorsToolStripMenuItem_Click(object sender, EventArgs e) { - + handleCheckOfObjectTypeMenuItem(sender, e); } - + + private void handleCheckOfObjectTypeMenuItem(object sender, EventArgs e) + { + // Set the current clicked item to item + ToolStripMenuItem item = sender as ToolStripMenuItem; + // Loop through all items in the subMenu and uncheck them but do check the clicked item + foreach (ToolStripMenuItem tempItemp in objectToolStripMenuItem.DropDownItems) + { + if (tempItemp == item) + tempItemp.Checked = true; + else + tempItemp.Checked = false; + } + } + + - //public class QBNameID //{ // public string Name { get; set; } @@ -411,7 +423,7 @@ namespace AyaNovaQBI //int rowIndexFromMouseDown; //int rowIndexOfItemUnderMouseToDrop; - + //private void gridAya_MouseDown(object sender, MouseEventArgs e) //{ // if (e.Button != MouseButtons.Left) @@ -442,9 +454,9 @@ namespace AyaNovaQBI //} - - + + private void gridAya_CellClick(object sender, DataGridViewCellEventArgs e) { @@ -463,7 +475,7 @@ namespace AyaNovaQBI private void gridQB_SelectionChanged(object sender, EventArgs e) { var hasSelection = gridQB.SelectedRows.Count > 0; - importSelectedItemsToolStripMenuItem.Visible=linkSelectedItemsToolStripMenuItem.Visible = hasSelection; + if (hasSelection) gridAya.ClearSelection(); } @@ -471,7 +483,7 @@ namespace AyaNovaQBI private void gridAya_SelectionChanged(object sender, EventArgs e) { var hasSelection = gridAya.SelectedRows.Count > 0; - importSelectedItemsToolStripMenuItem.Visible = linkSelectedItemsToolStripMenuItem.Visible = hasSelection; + if (hasSelection) gridQB.ClearSelection(); }