I could use some n00b level help. I saw the announ...
# doodle
r
I could use some n00b level help. I saw the announcement for 0.8.0 and decided to give it a try. However, I seem to be missing something important. More in thread:
When I run the code below (JVM), I see only a blank window, and
init
and
Hello World!
are printed to the console.
rendering
is never printed, and nothing shows up in the window. Am I missing something to get the rendering to actually start?
Using a
view { ... }
block in the app init appears to work fine. Not sure what the difference is, as
ViewBuilder
appears to be a very simple wrapper.
n
Views will only render if they have a non-zero size. You need to set some size to UserInfo, since it defaults to 0.
r
Ah, I see. So views don't automatically calculate their size bases on contents?
I guess that makes sense if everything is essentially just canvas draws. What would be the appropriate way to make this view match its size automatically?
n
They don't.
r
Also, why does the
view { ... }
block work?
n
TextMetrics is used for calculating the size of text. So you can compute the size upon unit in the UserInfo and set a size then. Of course you're drawing two lines, so you'd account for that in the calculation.
Work as in?
r
Ah, I see. Also, the block version does not appear to work for me now. I must have had a
size = display.size
in there the first time and not noticed. Thanks for the help!
(By works I meant it was showing up in the window and printing to the console)
n
I see. You can also set a Layout on the display to have it manage the size of the top level Views.
👍 1