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
Fixes #2195. CsvEditor: Column Type dialog not wide enough. #2203
Conversation
@BDisp - while testing this fix, I found a latent bug in Dialog. I think this will fix it: void LayoutStartedHandler ()
{
if (buttons.Count == 0 || !IsInitialized) return;
int shiftLeft = 0;
int buttonsWidth = GetButtonsWidth ();
switch (ButtonAlignment) {
case ButtonAlignments.Center:
// Center Buttons
shiftLeft = (Bounds.Width - buttonsWidth - buttons.Count - 2) / 2 + 1;
for (int i = buttons.Count - 1; i >= 0; i--) {
Button button = buttons [i];
shiftLeft += button.Frame.Width + (i == buttons.Count - 1 ? 0 : 1);
if (shiftLeft < 0) {
shiftLeft = 0;
}
button.X = Pos.AnchorEnd (shiftLeft);
button.Y = Pos.AnchorEnd (1);
}
break; The bug shows if you add significantly more buttons than will fit. E.g. 20: Can you incorporate this fix into this PR? The same |
@tig this isn't a bug. Is the normal center alignment behavior. Now the width will be less or equal to the width console. If there are significantly more buttons than will fit, then it will be centered on the available space. Otherwise your fix will be considered as left alignment. |
Could an enhancement be using 2+ lines for the |
It's a good suggestion, but I think is better to open a new issue. What can be still done in this PR is improving some more unit tests. |
You are right @tig, sorry, I've confused about the |
The errors related with this PR are already fixed, but still the tests fails due the same reason as #2212. |
Fixes #2195 - Changed
MessageBox
in theCsvEditor
to use layout computed. Also fixes theMessageBox
width calculation.Pull Request checklist:
CTRL-K-D
to automatically reformat your files before committing.dotnet test
before commit///
style comments)