-
Notifications
You must be signed in to change notification settings - Fork 694
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
Finish Dim.Auto
- DimAutoStyle.Content
is half-baked
#2432
Comments
I love this idea. But I wonder if You could have it take a maximum:
Maybe if its possible we could even give the max as a
|
Yes, I think it's a good idea. It's ideal for calculating content size to fit all views with the total of horizontal and vertical size. This size could be used on scroll bars to navigate through all the views. Some recursive method that will filter the sum of views size. |
Def worth thinking about more! I still like the simplicity of "Make the dimension just big enough to fit the subviews." I just realized that with the new View design, my example above of view.Padding.Thickness = new Thickness (1,1,1,1);
view.Width = Dim.Fit (); So, using the parameter for "Make the dimension just big enough to fit the subviews, plus a little more" isn't necessary. This does open up the possibility of a Max (and Min) parameter as you suggest. |
Instead of: |
I knew that, but wanted to make it clear to people who aren't familiar with Thickness that it has 4 dimensions. In my View prototype I've added public int Vertical {
get {
return Top + Bottom;
}
set {
Top = Bottom = value / 2;
}
}
public int Horizontal {
get {
return Left + Right;
}
set {
Left = Right = value / 2;
}
} |
@tig do you agree that absolute Edit: |
I now think Implementing was ridiculously easy (I've done very little testing, so something is probably broken). var textField = new TextField { Text = "Type here", X = 1, Y = 0, Width = 20, Height = 1 };
var label = new Label {
X = Pos.Left (textField),
Y = Pos.Bottom (textField),
AutoSize = true,
};
textField.TextChanged += (s, e) => {
label.Text = textField.Text;
};
var button = new Button () { Text = "Press to make button move down.",
X = Pos.Center(),
Y = Pos.Bottom (label),
};
button.Clicked += (s, e) => {
button.Y = button.Frame.Y + 1;
};
var view = new FrameView () {
Title = "Type in the TextField to make it grow.",
X = 3,
Y = 3,
Width = Dim.AutoSize (),
Height = Dim.AutoSize ()
};
view.Add (textField, label, button); |
Dim.Fit
to Computed Layout to automatically size views based on contentDim.Auot
to Computed Layout to automatically size views based on content
|
|
Dim.Auot
to Computed Layout to automatically size views based on contentDim.Auto
to Computed Layout to automatically size views based on content
Partially Fixes #2432 - `Dim.Auto` automatically sizes views based on `Text` - Replaces `View.AutoSize`
Now we need to address:
|
Dim.Auto
to Computed Layout to automatically size views based on contentDim.Auto
to automatically size views based on Text and/or Content
Dim.Auto
to automatically size views based on Text and/or ContentDim.Auto
- DimAutoStyle.Content
is half-baked
This feature has been partially implemented.
DimAutoStyle.Text
works great and fully replacedView.AutoSize
. However,DimAutoStyle.Computed
is still a WIP. We'll close this issue once it's fully implemented and tested.Background
See #2431 for some context.
Multiple times I've wanted to have a view dynamically be sized based on it's subviews. Also we have
AutoSize
which sorta does this forText
.I'd like to propose the following for v2:
Dim.Auto ()
AutoSize
with something that builds onDim.Auto ()
I think this should be possible, but haven't thought THAT much about it.
The text was updated successfully, but these errors were encountered: