Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show status bar text, add progress bar #2245

Merged
merged 2 commits into from
Jan 9, 2018

Conversation

HebaruSan
Copy link
Member

Problems

CKAN's GUI has a status bar that is always empty:

image

And some code that tries to set it:

CKAN/GUI/MainDialogs.cs

Lines 23 to 27 in 378d128

public void AddStatusMessage(string text, params object[] args)
{
Util.Invoke(StatusLabel, () => StatusLabel.Text = String.Format(text, args));
AddLogMessage(String.Format(text, args));
}

Currently they aren't connected.

Causes

Two different status bar controls are in use at the moment: the one that is visible, and the one that receives the status messages from code.

  • statusStrip1 is the control that's actually visible. It has no contained controls and none of its properties are set by code during downloads/installs.
  • StatusPanel is a panel which is technically added to the form but not visible. StatusLabel is a label which is added to this and which receives the status messages from the application, but again is not visible.

Changes

The status bar code is rewritten according to the documentation for StatusStrip.

  • StatusPanel is removed
  • StatusLabel is changed to type System.Windows.Forms.ToolStripStatusLabel and added to statuStrip1 instead
  • A new ToolStripProgressBar control is added to mirror the behavior of the progress bar on the install screen

Together, these changes make the status bar work as intended:

image

@HebaruSan HebaruSan added Bug Something is not working as intended GUI Issues affecting the interactive GUI labels Jan 8, 2018
Copy link
Member

@Olympic1 Olympic1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just add some small changes that the designer code requires

@@ -124,7 +124,6 @@ private void InitializeComponent()
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ModList)).BeginInit();
this.ModListContextMenuStrip.SuspendLayout();
this.StatusPanel.SuspendLayout();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this.statusStrip1.SuspendLayout();

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -1054,7 +1048,6 @@ private void InitializeComponent()
this.splitContainer1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.ModList)).EndInit();
this.ModListContextMenuStrip.ResumeLayout(false);
this.StatusPanel.ResumeLayout(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add

this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

this.StatusProgress.Minimum = 0;
this.StatusProgress.Maximum = 100;
this.StatusProgress.Size = new System.Drawing.Size(300, 20);
this.StatusProgress.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this.StatusProgress.Name = "StatusProgress";

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

this.StatusLabel.Name = "StatusLabel";
this.StatusLabel.Size = new System.Drawing.Size(1050, 29);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave Size in

this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Padding = new System.Windows.Forms.Padding(2, 0, 21, 0);
this.statusStrip1.Size = new System.Drawing.Size(1544, 22);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave Size in

// statusStrip1
//
this.statusStrip1.ImageScalingSize = new System.Drawing.Size(24, 24);
this.statusStrip1.Location = new System.Drawing.Point(0, 1016);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave Location in

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, the IDE probably needs that stuff for the graphical editor, doesn't it? OK...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@Olympic1 Olympic1 merged commit 19ec0f1 into KSP-CKAN:master Jan 9, 2018
Olympic1 added a commit that referenced this pull request Jan 9, 2018
@Olympic1 Olympic1 removed the Bug Something is not working as intended label Jan 9, 2018
@HebaruSan HebaruSan deleted the fix/status-bar branch January 9, 2018 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GUI Issues affecting the interactive GUI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants