I had a user request a control that would allow for the output of messages from a UDInput so they could see progress. This uses the Stack class so it writes new messages to the top, outputs them into a collection and then adds a scrollbar after it reaches 200px.
I am in the process of making a terminal window but have run into an issue where I am having difficulty making the scroll bar auto scroll to the newest element at the bottom of the window.
As you can see I have taken your demo code above and swapped to an ArrayList, also the New-UDCollection I guess has been depreciated so I have removed it. The example code at the bottom of this page is the desired affect I am trying to accomplish CSS scrolling with top overflow
This mentions calling a method called scrolltop like the example here.
$(“#wordlist”).scrollTop($(‘#wordlist’).height())
I’m not sure how to add the style attributes needed to my code to get this to work also I don’t know how to go about calling the scrollTop method from PowerShell universal. Any help would be appreciated and if also this is the right way to go about it.
So I have made progress in that I have a changed the button to scroll to bottom when clicked. But is there a way to make it do so automatically after its finished listing the elements? here is my new code below with the button click “Scroll to Bottom”.
I now have something in place which works but was hoping someone could explain to me why having the Invoke-UDJavascript encased in New-UDButton and then calling the click() method works instead of just straight calling the method which does nothing. Also if someone has a more efficient way of doing this like appending only the new elements to the list and displaying them instead of constructing the whole list every time a new element is added.