Autoscroll textbox

0
0

The textbox is missing the ScrollToCaret or ScrollToEnd function and I wanted to see if I could call it from javascript.

var textarea = document.getElementById('textarea_id');
textarea.scrollTop = textarea.scrollHeight;

textBox.Call("scrollTop", 10000)?
textBox.Call("this.scrollTop = this.scrollHeight")?

Any ideas?

            
  • You must to post comments
0
0

Hi Mark,

ScrollToX and ScrollToY have been added to the TextBox in Wisej 1,3.82

Best regards
Frank

  • You must to post comments
0
0

var lastCtrl = BladeHost.Controls.Cast<Control>().LastOrDefault();
if (lastCtrl == null)
{
return;
}

this.ActiveControl = lastCtrl;
BladeHost.ScrollControlIntoView(lastCtrl);
BladeHost.HorizontalScroll.Value = this.BladeHost.Width;

  • You must to post comments
0
0

Could it be added to the Panel or FlowLayout panel as well?

Our application adds new UserControls to a Flowlayout panel and then we are doing this after we add a new control.

var totalWidth = Blades.Sum(n => n.Width); /Total width of all added controls
BladeHost.Call(“scrollToX”, totalWidth); /Scroll to the far right (BladeHost is a flowlayout panel)

  • Mark Reed
    I was actually able to fix this without calling javascript This code seems to do what I need. var lastCtrl = BladeHost.Controls.Cast().LastOrDefault(); if (lastCtrl == null) { return; } this.ActiveControl = lastCtrl; BladeHost.ScrollControlIntoView(lastCtrl); BladeHost.HorizontalScroll.Value = this.BladeHost.Width;
  • You must to post comments
1
0

scrollTop and scrollLeft are low level properties of the <textarea> DOM element while Wisej widgets are javascript widgets. You’d have to retrieve the DOM element to manipulate it directly. Also, most Wisej widgets are composite widgets. In the case of the TextBox, it’s actually a container because it supports tool buttons on the left and the right of the inner text field.

Wisej  (qooxdoo) provides an intermediate object, called the content element, that abstracts browser specific features. So in this case, you can call scrollToX and scrollToY:

this.textBox1.Eval(“this.getChildControl(‘textfield’).getContentElement().scrollToY(10)”);
this.textBox1.Eval(“this.getChildControl(‘textfield’).getContentElement().scrollToX(10)”);

The line above retrieves the inner textfield, then it  gets the content element implementation, and calls either scrollToY() or scrollToX().  http://www.qooxdoo.org/current/api/#qx.html.Element~scrollToY!method_public

I will also log an enhancement to add ScrollToX and ScrollToY methods to the TextArea control. The result is the same, just simpler syntax.

Best,

Luca

 

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.