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

Proposal: fluent API #181

Closed
zabulus opened this issue Apr 18, 2019 · 1 comment
Closed

Proposal: fluent API #181

zabulus opened this issue Apr 18, 2019 · 1 comment

Comments

@zabulus
Copy link

zabulus commented Apr 18, 2019

Hi there. Good library, looks pretty awesome!
But I have a proposal for API.
From samples:

	win.Add (
	    // The ones with my favorite layout system
  	    login, password, loginText, passText,

It's quite hard to gather all controls, that I've spawned before to add to win through Add method (I've created around 5 or 6 label-text pairs, and it's already cumbersome to register them all in win).
Proposal is following:

loginLabel = win.Label("Login")
   .Position(3, 2);
passwordLabel = win.Label("Password")
   .Position(Pos.Left(loginLabel), Pos.Top(loginLabel) + 1);

This will allow to combine adding to win and initialization of objects. I'll create my own extension methods, as I see there is nothing complicated and that could be done from consumer side.

@migueldeicaza
Copy link
Collaborator

migueldeicaza commented Apr 29, 2019

This is generally a good idea, but I would like to see a comprehensive proposal to what this does.

Generally, .NET guidelines do not use fluent APIs, and I would like to learn more about what the good practices are for this.

Feel free to reopen when we have a more comprehensive design.

tig pushed a commit to tig/Terminal.Gui that referenced this issue Sep 3, 2024
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

No branches or pull requests

2 participants