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

ComboBox assumes constructor initialization; needs to support object initialization #559

Closed
tig opened this issue May 27, 2020 · 3 comments
Assignees
Labels

Comments

@tig
Copy link
Collaborator

tig commented May 27, 2020

If someone is using Computed Layout they have to use the only constructor provided:

	public ComboBox(int x, int y, int w, int h, IList<string> source)

Like this, which is gross:

		var comboBox = new ComboBox (0, 0, 0, 0, new List<string> () { " ~  s  gui.cs   master ↑10" } ) { 
			X = Pos.Right (label) + 1, 
			Y = Pos.Y (label), 
			Width = Dim.Percent (50),
             }

It also appears it was never tested with object initialziation because this causes it to crash:

		var comboBox = new ComboBox (0, 0, 0, 0, new List<string> () { " ~  s  gui.cs   master ↑10" } ) { 
			X = Pos.Right (label) + 1, 
			Y = Pos.Y (label), 
			Width = Dim.Percent (50),
                         Text = "foo",
             }

In general View classes should

  1. Not require use of a parametrized constructor (except when forcing Absolute Layout *)
  2. Avoid doing initialization via constructors. Instead use a property so consumers can use object initialization (e.g. var foo = new Foo() { a = b };).

** We should support specifying absolute coordinates via fields on View

@fergusonr
Copy link
Contributor

@tig please assign this to me. I Have been looking at it, I'm about 70% done with the fix.

@tig
Copy link
Collaborator Author

tig commented Jun 1, 2020

@fergusonr Suggest you pull down #586 and #587 as you do this work.

@fergusonr
Copy link
Contributor

Fix is done. PR #607

@tig tig closed this as completed Jun 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants