From 817693ba413996f6ecd00f376b9862baa333ef38 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 28 Jul 2021 20:36:22 +0100 Subject: [PATCH] Fixed: don't edit when nothing selected on listbox --- Windows/Forms/EditTileFolderForm.cs | 47 ++++++++++++++++------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/Windows/Forms/EditTileFolderForm.cs b/Windows/Forms/EditTileFolderForm.cs index a16b75e..3fdf26a 100644 --- a/Windows/Forms/EditTileFolderForm.cs +++ b/Windows/Forms/EditTileFolderForm.cs @@ -63,10 +63,10 @@ namespace FizzyLauncher.Windows.Forms this.label2 = new System.Windows.Forms.Label(); this.tHorizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator(); this.SuspendLayout(); - // + // // textBox1 - // - this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + // + this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textBox1.BackColor = System.Drawing.Color.Transparent; this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); @@ -78,9 +78,9 @@ namespace FizzyLauncher.Windows.Forms this.textBox1.SubmitButton = null; this.textBox1.TabIndex = 152; this.textBox1.UseSystemPasswordChar = false; - // + // // label1 - // + // this.label1.AutoSize = true; this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.ForeColor = System.Drawing.SystemColors.ControlText; @@ -92,9 +92,9 @@ namespace FizzyLauncher.Windows.Forms this.label1.TabIndex = 153; this.label1.Text = "Title"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // // button1 - // + // this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.button1.BackColor = System.Drawing.Color.Transparent; this.button1.DefaultImage = null; @@ -109,10 +109,10 @@ namespace FizzyLauncher.Windows.Forms this.button1.Size = new System.Drawing.Size(128, 32); this.button1.TabIndex = 173; this.button1.Click += new System.EventHandler(this.button1_Click); - // + // // horizontalSeparator2 - // - this.horizontalSeparator2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + // + this.horizontalSeparator2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.horizontalSeparator2.AutoScrollMargin = new System.Drawing.Size(0, 0); this.horizontalSeparator2.AutoScrollMinSize = new System.Drawing.Size(0, 0); @@ -125,12 +125,12 @@ namespace FizzyLauncher.Windows.Forms this.horizontalSeparator2.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10); this.horizontalSeparator2.Size = new System.Drawing.Size(364, 22); this.horizontalSeparator2.TabIndex = 177; - // + // // listBox1 - // + // this.listBox1.AllowDrop = true; - this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.listBox1.BackColor = System.Drawing.Color.Transparent; this.listBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); @@ -145,9 +145,9 @@ namespace FizzyLauncher.Windows.Forms this.listBox1.OnEdit += new System.EventHandler(this.listBox1_OnEdit); this.listBox1.DragDrop += new System.Windows.Forms.DragEventHandler(this.listBox1_DragDrop); this.listBox1.DragOver += new System.Windows.Forms.DragEventHandler(this.listBox1_DragOver); - // + // // label2 - // + // this.label2.AutoSize = true; this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.ForeColor = System.Drawing.SystemColors.ControlText; @@ -158,10 +158,10 @@ namespace FizzyLauncher.Windows.Forms this.label2.TabIndex = 181; this.label2.Text = "List"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // // tHorizontalSeparator1 - // - this.tHorizontalSeparator1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + // + this.tHorizontalSeparator1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tHorizontalSeparator1.AutoScrollMargin = new System.Drawing.Size(0, 0); this.tHorizontalSeparator1.AutoScrollMinSize = new System.Drawing.Size(0, 0); @@ -174,9 +174,9 @@ namespace FizzyLauncher.Windows.Forms this.tHorizontalSeparator1.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10); this.tHorizontalSeparator1.Size = new System.Drawing.Size(364, 22); this.tHorizontalSeparator1.TabIndex = 182; - // + // // AddTileFolderForm - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.ClientSize = new System.Drawing.Size(384, 521); this.Controls.Add(this.tHorizontalSeparator1); @@ -312,6 +312,11 @@ namespace FizzyLauncher.Windows.Forms return; } + if (listBox1.ListBox.SelectedIndex < 0) + { + return; + } + EditTileForm.ShowEditDialog(listBox1); }