-
Notifications
You must be signed in to change notification settings - Fork 695
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 #1785. Adds Pos.Align
- Align sets of views horizontally or vertically
#3415
Conversation
While this does not yet have sufficient unit tests, it is ready for review. I'm specifically looking for feedback on the API. The typical use-case where someone has a set of horizontal subviews they want justified (e.g. Button button1 = new () { Title = "Button 1", X = Pos.Justify(Justification.Center), Y = Pos.Bottom() };
Button button2 = new () { Title = "Button 2", X = Pos.Justify(Justification.Center), Y = Pos.Bottom() };
Button button3 = new () { Title = "Button 3", X = Pos.Justify(Justification.Center), Y = Pos.Bottom() };
Add (button1, button2, button3); If there are multiple groups: const int CHECKBOXGROUP = 1;
Checkbox cb1 = new () { Title = "Check 1", X = Pos.Justify(Justification.Justified, CHECKBOXGROUP), Y = 0};
Checkbox cb2 = new () { Title = "Check 2", X = Pos.Justify(Justification.Justified, CHECKBOXGROUP), Y = 0};
Checkbox cb3 = new () { Title = "Check 3", X = Pos.Justify(Justification.Justified, CHECKBOXGROUP), Y = 0};
Add (cb1, cb2, cb3);
const int BUTTONGROUP = 2;
Button button1 = new () { Title = "Button 1", X = Pos.Justify(Justification.Center, BUTTONGROUP), Y = Pos.Bottom() };
Button button2 = new () { Title = "Button 2", X = Pos.Justify(Justification.Center, BUTTONGROUP), Y = Pos.Bottom() };
Button button3 = new () { Title = "Button 3", X = Pos.Justify(Justification.Center, BUTTONGROUP), Y = Pos.Bottom() };
Add (button1, button2, button3); I'm open for suggestions for other ways to let devs have multiple sets of views that are independently justified other than the somewhat clunky "GroupID" concept. I've tried multiple things, including trying to make it automatic based on the opposite dimension, but what I have now seems to be the cleanest. |
Added [GenerateEnumExtensionMethods] to DimAutoStyle. Reordered DimAutoStyle.
Fixes gui-cs#3469, gui-cs#3473, gui-cs#3482 - `Dim.Auto` fixes and `Pos`/`Dim` refactor to support TGD
@tznind, @BDisp, @dodexahedron: Now that #3480 has been merged, I've made final tweaks to this one and it's ready for you to review (again). |
… for MessageBox/Dialog. Messagebox and Dialog now use Pos.Align and Dim.Auto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, feel free to silence those warnings from the generator test project, if you want to, since that's just going to be moved anyway and I'm addressing any warnings thrown by it before it gets uploaded.
May as well quiet the noise.
Fixes
Pos.Align
to ease aligning subviews:Left
,Right
,Center
,Justify
#1785Proposed Changes/Todos
Pos.Justify
that automatically justifies views on the same X or Y axis with the same Justification settingGeneric
scenario.Justification
class to be an instance class that can hold all the settings, callingJustification.Justify(...)
static methodPosJustification
ScenarioJustifier
-> Add eventsPos.Justify
-> Cache locationDialog
(andMessageBox
)TextAlignment
and `VerticalTextAlignment``enums.Alignment
andAlignmentModes
enums to leverage Maui terminology.EndToStart
alignment inAligner
EndToStart
in Pos.Align ScenarioPull Request checklist:
CTRL-K-D
to automatically reformat your files before committing.dotnet test
before commit///
style comments)