ScrollView Not Working, Misunderstanding? #1049
-
I've started a repo where I want to build a terminal version of something akin to Azure Data Studio or Microsoft SQL Server Management Studio. I'm running this on Ubuntu 20.04 as a .net5.0 project / netstandard 2.1. For this demo I've been using the AdventureWorksDW2019 database on MS SQL Server on my local machine. To compare results, I've been using Azure Data Studio. I'm having trouble getting the ScrollView to work. My code is here. I apologize in advance, this is all very rough proof of concept code and needs to be cleaned up. In this class, I have a Window, which has a TextView and a ScrollView. The TextView is added to the ScrollView, and then ScrollView is added to the Window. Basically, when the user executes a SQL query and gets the result set back, I return to the UI a List of formatted strings representing the data set, to be rendered in the TextView. I am expecting the ScrollView to automatically add scrollbars to the UI and to be able to scroll left, right, up, down for very large data sets. However, this almost never works. I thought perhaps the problem was that I needed to dynamically adjust the ContentSize, so now I've tried calculating the max width and height that the TextView is going to display and setting that as the ContentSize for the ScrollView, but that doesn't seem to help either. Basically, sometimes the horizontal scrollbar works, and sometimes it doesn't, especially if I am re-sizing the console window itself. The vertical scrollbar almost never works. Assuming you have the same environment as me, reproduction steps (in the branch dev_ui) -
From here, observe that the "Output" window that I have attempts to render the result set, but the scrollbars don't appear to work at all, or sometimes occasionally works if you resize the OS's console window - at least for me, the horizontal scrollbar works, but the vertical one doesn't work period. I've been banging my head on this for about 5 days now, so any help is appreciated. Any suggestions are welcome on improving my code / what to change / my mis-understanding of how the gui.cs framework is supposed to work. Thank you for your time. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
I can't help with the scroll view but if you want to show a result set in a formatted table (with horizontal and vertical scrolling) then I would appreciate any feedback on my PR (TableView) since this is exactly what it is designed to do (show tabular data via |
Beta Was this translation helpful? Give feedback.
-
Hello, Short version: you do not need the scrollview today. TextView handles the content on its own, and does not have a use for the ScrollView. I can see that would be useful, but at this point, if you would like to make this work, you would need to do a lot of work to essentially have the TextView Frame track the size of the contents, and then add that to the scrollview - and you would need to manage the cursor on your own. Your concern is a valid one, it would be nice to support scrollbars on the TextView, please file an issue. |
Beta Was this translation helpful? Give feedback.
-
See this PR #1081. |
Beta Was this translation helpful? Give feedback.
Hello,
Short version: you do not need the scrollview today.
TextView handles the content on its own, and does not have a use for the ScrollView. I can see that would be useful, but at this point, if you would like to make this work, you would need to do a lot of work to essentially have the TextView Frame track the size of the contents, and then add that to the scrollview - and you would need to manage the cursor on your own.
Your concern is a valid one, it would be nice to support scrollbars on the TextView, please file an issue.