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

Must set AutoSize to false before setting Width #3366

Closed
tznind opened this issue Apr 1, 2024 · 5 comments
Closed

Must set AutoSize to false before setting Width #3366

tznind opened this issue Apr 1, 2024 · 5 comments
Labels

Comments

@tznind
Copy link
Collaborator

tznind commented Apr 1, 2024

Must set AutoSize to false before setting Width

I get this exception a lot now when trying to upgrade TGD. Is it a temporary measure?

It seems like this is an attempt to prevent two conflicting sizing mechanisms (auto and Width). If it is here to stay then why instead not just make AutoSize a Dim e.g.

myView.Width = Dim.AutoSize()
// Or
myView.Width = Dim.AutoWidth(myView)
// Or
myView.Width = Dim.AutoSize(myView,width: true)

If it were a Dim then it wouldn't be possible to set both, Width would either be auto or other.

Maybe a View has to implement IAutoSizeable or something to support this approach.

@tznind tznind added the question label Apr 1, 2024
@tig
Copy link
Collaborator

tig commented Apr 1, 2024

This is temporary, but only because AutoSize is going away once I finish Dim.Auto.

The reason this is in there now is before AutoSize was not deterministic w.r.t. when/where Height/Width got set.

I refactored the code in #3202 to simplify it ahead of finishing Dim.Auto. To make it all understantable I removed all code that tried to allow changes to Width/Height work (it never could be cause of race conditions).

Before setting those properties if AutoSize is on was supposed to work, but didn't really.

Now setting those properties if AutoSize is on is an error.

@tznind
Copy link
Collaborator Author

tznind commented Apr 1, 2024

This is temporary, but only because AutoSize is going away once I finish Dim.Auto.

So the new way to autosize is going to be Dim.Auto? Maybe the way for me to progress here would be to just set AutoSize to false anywhere I am setting a Dim property or creating a View.

@tig
Copy link
Collaborator

tig commented Apr 1, 2024

This is temporary, but only because AutoSize is going away once I finish Dim.Auto.

So the new way to autosize is going to be Dim.Auto? Maybe the way for me to progress here would be to just set AutoSize to false anywhere I am setting a Dim property or creating a View.

The only built-in views that enable AutoSize = true are Button and Label.

@realChrisDeBon
Copy link

This is temporary, but only because AutoSize is going away once I finish Dim.Auto.

So the new way to autosize is going to be Dim.Auto? Maybe the way for me to progress here would be to just set AutoSize to false anywhere I am setting a Dim property or creating a View.

The only built-in views that enable AutoSize = true are Button and Label.

So we should set AutoSize to false prior to adjusting Height or Width of either of these elements? My entire application locks up if I tinker with an element's height or width it seems.

@tig
Copy link
Collaborator

tig commented Apr 1, 2024

This is temporary, but only because AutoSize is going away once I finish Dim.Auto.

So the new way to autosize is going to be Dim.Auto? Maybe the way for me to progress here would be to just set AutoSize to false anywhere I am setting a Dim property or creating a View.

The only built-in views that enable AutoSize = true are Button and Label.

So we should set AutoSize to false prior to adjusting Height or Width of either of these elements? My entire application locks up if I tinker with an element's height or width it seems.

Correct.

@tig tig closed this as not planned Won't fix, can't repro, duplicate, stale Apr 2, 2024
tig added a commit that referenced this issue Apr 14, 2024
Fixes #3366 - Add ability to disable AutoSize
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

3 participants