Eto TextAreas inside a Scrollable question

eto

#1

I have two eto.Forms.TextAreas that I would like to vertically scroll simultaneously. I can guarantee that they will always have the same number of lines. I put them in a TableLayout, inside a Scrollable, inside the main form layout (another table).

I cannot figure out how to make the TextAreas not kick in their own scroll bars. Is there a ‘proper’ way to accomplish this?

The best compromise so far is to set the height based on font.LineHeight * number of lines * some factor greater than 1, and make sure the Scrollable.ExpandContentHeight is True. I’m not sure what LineHeight of a font represents (pixels ?), and experimenting suggests 1.4 is my magic factor to prevent TextArea scrollbars from appearing, but not leaving too much space below the last line in the TextAreas. It seems like I am going about this incorrectly, but haven’t found anything else yet (general googling or here), thus starting the topic.

Thanks.


(Curtis Wensley) #4

Hey @nathancoatney,

Thanks for the question, but currently Eto does not expose any direct way to manipulate the scroll bars or their position of TextArea, RichTextArea, TextBox, etc. Only Scrollable. I think your compromise might be the best bet at this point, and submit an issue to Eto on GitHub to request this feature for a future version.

Also, just so you know all measurements for the Font (e.g. LineHeight) are in points. On Windows it is typically 96 DPI, and on Mac it’s 72 DPI. You can use Screen.Scale to multiply the point values to get the pixel size.

Hope this helps!
Curtis.


#5

Ok thanks!