|
Post by Roger Cabo on Nov 8, 2020 17:15:20 GMT 1
Hi everyone,
I like to move a slider of a RTF Textbox to 0 by code. Does anyone know how to?
Thank you
|
|
|
Post by dragonjim on Dec 24, 2020 22:54:57 GMT 1
Hi, Have you tried SetScrollPos?
|
|
|
Post by Roger Cabo on Dec 31, 2020 23:40:30 GMT 1
Hi, Have you tried SetScrollPos? Hi, Unfortunately rft1.SetScrollPos is an unknown property for this control.
|
|
|
Post by dragonjim on Jan 1, 2021 16:05:30 GMT 1
Hi again, Sorry, I was referring to the API SetScrollPos... link
|
|
|
Post by Roger Cabo on Jan 26, 2021 19:11:13 GMT 1
This works for me: Sub cmd_GotoTop_Click rtf1.SelStart = 0 rtf1.SelLength = 0 rtf1.SetFocus Hi thank you, works for the horizontal scrollbar as well. Dim oldPos% = rtf1.SelStart Dim oldLen% = rtf1.SelLength rtf1.SelStart = rtf1.CharFromLine(rtf1.SelLine) rtf1.SelLength = 0 rtf1.SetFocus rtf1.SelStart = oldPos% rtf1.SelLength = oldLen% rtf1.SetFocus
|
|
|
Post by (X) on Jun 3, 2022 2:59:16 GMT 1
This is a variation of putting the cursor at position 0. Instead, the following code positions the cursor at the end-of-text and simultaneously brings then end-of-text into view. This way you can have the effect of an up scrolling terminal screen. Visual Basic seems to have this covered with a <textbox>.AppendText() command.
<editbox>.SetFocus SendKeys "^{END}", True
I suppose one could create a procedure called AppendText()...
Proc AppendText(tb As TextBox, s$) '''''''''''''''''''''''''''''''''''''''''''''''''' ' Append text to specified multiline textbox ' control and automatically bring the appended ' text into view. ' tb.SetFocus SendKeys "^{END}", True tb.text = tb.text & s$ tb.SetFocus SendKeys "^{END}", True EndProc
I just couldn't get other methods working. For example, the following code moves the cursor to the end of text, but, if the end of text is beyond the bottom of the edit box, then, the text will be written out of sight and it stays out of sight.
<editbox>.SelStart = Len(<editbox>.Text) <editbox>.SelLength = 0 <editbox>.SetFocus
|
|