question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dim.Percent() generating incorrect Width

See original GitHub issue

The code below produces this result. The right hand TextField does not have a width of 40%

image

Application.Init();

var win = new Window("Test") { X = 0, Y = 0, Width = Dim.Fill(), Height = Dim.Fill() };

var textLeft = new TextField("Left") { X = 0, Y = 0, Width = Dim.Percent(40) };
var textRight = new TextField("Right") { X = Pos.Right(textLeft)+1,  Width = Dim.Percent(40) };
win.Add(textLeft, textRight);

Application.Top.Add(win);
Application.Run ();

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
migueldeicazacommented, Jun 16, 2020

Thank you for the explanation BDisp! I did notice it, and I could swear I put a comment somewhere, but not here.

Thank you!

1reaction
tigcommented, Jun 5, 2020

I’ve sensed something wrong here too, but wasn’t sure. Thanks for getting a good repro!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dim.Percent() generating incorrect Width · Issue #623
Actually, I believe Dim.Percent is designed to provide a width that is relative to the area to the right (or below) the view....
Read more >
Are the decimal places in a CSS width respected?
If it's a percentage width, then yes, it is respected: #outer { width: 200px; } #first { width: 50%; height: 20px; background-color: red;...
Read more >
<percentage> - CSS: Cascading Style Sheets - MDN Web Docs
The CSS data type represents a percentage value. It is often used to define a size as relative to an element's parent object....
Read more >
Setting Height And Width On Images Is Important Again
Yes, when an image is being shown at full size, without any CSS changing any dimensions, it is useful to resolve the layout...
Read more >
Centering Percentage Width/Height Elements
If you know the exact width/height of an element, you can center it ... Instead of using negative margins, you use negative translate()...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found