Skip to content

Commit

Permalink
- Make the MessageBoix be RTL and RightAlign aware
Browse files Browse the repository at this point in the history
- Fixes #313
- Demonstrates #343
  • Loading branch information
Smurf-IV committed Sep 13, 2021
1 parent a5964d9 commit 18cd619
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 12 deletions.
1 change: 1 addition & 0 deletions Documents/Help/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Sort out the Callback actions that were removed
* Fixed [#316](https://github.com/Krypton-Suite/Standard-Toolkit/issues/316), Restore `KryptonKInputBox` layout to initial intent.
* Fixed [#333](https://github.com/Krypton-Suite/Standard-Toolkit/issues/333), Krypton Form - ButtonSpec (And Icon), are Cut Off when maximised
* Fixed [#313](https://github.com/Krypton-Suite/Standard-Toolkit/issues/313), KryptonMessagebox is not RTL compliant
=======

## 2021-09-01 - Build 2109 - September 2021 (Canary)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
#endregion

// This file holds the global definitions > C# 10
// This file holds the global definitions >= C# 10

global using System;
global using System.Collections;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
#endregion

// This file holds the global definitions > C# 10
// This file holds the global definitions >= C# 10

global using System;
global using System.Collections;
Expand Down

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal partial class KryptonMessageBoxForm : KryptonForm
private readonly MessageBoxIcon _messageBoxIcon;

private readonly MessageBoxDefaultButton _defaultButton;
private MessageBoxOptions _options; // TODO: What is this used for ? e.g. MessageBoxOptions.RTL
private MessageBoxOptions _options; // https://github.com/Krypton-Suite/Standard-Toolkit/issues/313
// If help information provided or we are not a service/default desktop application then grab an owner for showing the message box
private readonly IWin32Window _showOwner;
private readonly HelpInfo _helpInfo;
Expand Down Expand Up @@ -88,6 +88,8 @@ internal KryptonMessageBoxForm(IWin32Window showOwner, string text, string capti
_helpInfo = helpInfo;
_showOwner = showOwner;

RightToLeftLayout = _options.HasFlag(MessageBoxOptions.RtlReading);

// Create the form contents
InitializeComponent();

Expand All @@ -109,6 +111,11 @@ private void UpdateText()
{
Text = (string.IsNullOrEmpty(_caption) ? string.Empty : _caption.Split(Environment.NewLine.ToCharArray())[0]);
_messageText.Text = _text;
_messageText.RightToLeft = _options.HasFlag(MessageBoxOptions.RightAlign)
? RightToLeft.Yes
: _options.HasFlag(MessageBoxOptions.RtlReading)
? RightToLeft.Inherit
: RightToLeft.No;
}

private void UpdateTextExtra(bool? showCtrlCopy)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
#endregion

// This file holds the global definitions > C# 10
// This file holds the global definitions >= C# 10

global using System;
global using System.Collections;
Expand Down

0 comments on commit 18cd619

Please sign in to comment.