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

Add SuppressedProperty Visible #228

Merged
merged 1 commit into from
Aug 30, 2023
Merged

Add SuppressedProperty Visible #228

merged 1 commit into from
Aug 30, 2023

Conversation

tznind
Copy link
Collaborator

@tznind tznind commented Aug 30, 2023

Adds the concept of 'Suppressed' properties. These manifest only in the code generated but are not visible in the editor (i.e. property is not set on the View that is hosted in the main editing window).

This is consistent with the behaviour of e.g. the WinForms editor when handling properties such as Visible. The user should be able to see from the property info that the view is not visible but it should remain clickable, draggable etc in the editor.

visible-no

//------------------------------------------------------------------------------

//  <auto-generated>
//      This code was generated by:
//        TerminalGuiDesigner v1.0.24.0
//      Changes to this file may cause incorrect behavior and will be lost if
//      the code is regenerated.
//  </auto-generated>
// -----------------------------------------------------------------------------
namespace YourNamespace {
    using System;
    using Terminal.Gui;
    
    
    public partial class MyView : Terminal.Gui.Window {
        
        private Terminal.Gui.Button button;
        
        private void InitializeComponent() {
            this.button = new Terminal.Gui.Button();
            this.Width = Dim.Fill(0);
            this.Height = Dim.Fill(0);
            this.X = 0;
            this.Y = 0;
+           this.Visible = true;
            this.Modal = false;
            this.Border.BorderStyle = Terminal.Gui.BorderStyle.Single;
            this.Border.BorderBrush = Terminal.Gui.Color.White;
            this.Border.Effect3D = false;
            this.Border.Effect3DBrush = null;
            this.Border.DrawMarginFrame = true;
            this.TextAlignment = Terminal.Gui.TextAlignment.Left;
            this.Title = "";
            this.button.Width = 24;
            this.button.Height = 1;
            this.button.X = 11;
            this.button.Y = 4;
+           this.button.Visible = false;
            this.button.Data = "button";
            this.button.Text = "I will be invisible!";
            this.button.TextAlignment = Terminal.Gui.TextAlignment.Centered;
            this.button.IsDefault = false;
            this.Add(this.button);
        }
    }
}

@tznind tznind marked this pull request as ready for review August 30, 2023 04:55
@tznind tznind requested a review from BDisp August 30, 2023 04:55
Copy link
Contributor

@BDisp BDisp left a comment

Choose a reason for hiding this comment

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

Nice catch and very nice work to handle this very important reality. Please see my review. Thanks.

src/Design.cs Show resolved Hide resolved
@tznind tznind merged commit 5dd62b5 into main Aug 30, 2023
1 check passed
@tznind tznind deleted the design-visible branch August 30, 2023 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants