From 78f4a083229e2796918d46e617d049f8f816be7a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 22 Nov 2025 00:09:15 +0000 Subject: [PATCH] Implement step 3: Update MessageBox to use Dialog.Result - Simplified QueryFull method to use Dialog.Result instead of manual tracking - Removed custom button Data and Click tracking logic - Buttons now simply call RequestStop and Dialog extracts the result automatically - Updated legacy Clicked property with deprecation note - Maintained backward compatibility by keeping Clicked updated Co-authored-by: tig <585482+tig@users.noreply.github.com> --- Terminal.Gui/Views/MessageBox.cs | 50 +++++++++++++++++--------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/Terminal.Gui/Views/MessageBox.cs b/Terminal.Gui/Views/MessageBox.cs index bdbf323a0..073bb2d1f 100644 --- a/Terminal.Gui/Views/MessageBox.cs +++ b/Terminal.Gui/Views/MessageBox.cs @@ -56,7 +56,14 @@ public static class MessageBox /// based console where there is no SynchronizationContext or TaskScheduler. /// /// - /// Warning: This is a global variable and should be used with caution. It is not thread safe. + /// + /// Warning: This is a global variable and should be used with caution. It is not thread safe. + /// + /// + /// Deprecated: This property is maintained for backward compatibility. The MessageBox methods + /// now return the button index directly, and provides a cleaner, + /// non-global alternative for custom dialog implementations. + /// /// public static int Clicked { get; private set; } = -1; @@ -340,7 +347,6 @@ public static class MessageBox // Create button array for Dialog var count = 0; List