473,396 Members | 1,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

keep it scrolled

M D
System.Windows.Forms.Textbox

Imagine a multiple line text box that never gets focus. For instance
the conversation box of a chat screen.

How can you keep it scrolled to the bottom as lines are added.
Textbox.ScrollToCaret() requires the control be in focus and I would
rather not be swapping around focus while users are, well, using.

thx
md

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
2 1704
Might this be the awnser?
textBox.Append("Blabla");
"M D" <ma******@aol.com> wrote in message
news:uM**************@tk2msftngp13.phx.gbl...
System.Windows.Forms.Textbox

Imagine a multiple line text box that never gets focus. For instance
the conversation box of a chat screen.

How can you keep it scrolled to the bottom as lines are added.
Textbox.ScrollToCaret() requires the control be in focus and I would
rather not be swapping around focus while users are, well, using.

thx
md

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #2
You can automatically scroll using the send message api

//constants
private const int WM_HSCROLL = 0x114
private const int WM_VSCROLL = 0x115
private const int SB_LINEUP = 0
private const int SB_LINELEFT = 0
private const int SB_LINEDOWN = 1
private const int SB_LINERIGHT = 1
private const int SB_PAGEUP = 2
private const int SB_PAGELEFT = 2
private const int SB_PAGEDOWN = 3
private const int SB_PAGERIGHT = 3
private const int SB_THUMBPOSITION = 4
private const int SB_THUMBTRACK = 5
private const int SB_TOP = 6
private const int SB_LEFT = 6
private const int SB_BOTTOM = 7
private const int SB_RIGHT = 7
private const int SB_ENDSCROLL = 8
[DllImport("user32.dll")]
private static extern int SendMessage(IntPtr hWnd, int wMsg, IntPtr wParam,
IntPtr lParam);

Usage -

//when you want the textbox to scroll bottom do this
SendMessage(textBox1.Handle, WM_VSCROLL, (IntPtr) SB_BOTTOM, IntPtr.Zero);
--
Shak
C# / .NET MCP
(Houston)


"M D" <ma******@aol.com> wrote in message
news:uM**************@tk2msftngp13.phx.gbl...
System.Windows.Forms.Textbox

Imagine a multiple line text box that never gets focus. For instance
the conversation box of a chat screen.

How can you keep it scrolled to the bottom as lines are added.
Textbox.ScrollToCaret() requires the control be in focus and I would
rather not be swapping around focus while users are, well, using.

thx
md

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Vangelis Natsios | last post by:
I want to create a page with a scrolling image that will cause different messages to appear on another part of the page (say, another <div>) as the image will scroll. Imagine something like this: ...
1
by: jongyoo | last post by:
I've got this code where when you click the '-' or '+' link the text in the textbox increments or decrements. But let's say this is at the end of the page after it is scrolled all the way to the...
0
by: Dave | last post by:
I have a listview that I clear refresh at regular intervals. I can retain the selected itemOK, but if the listview has been scrolled I would like to get the top item back to the top after the...
5
by: balakrishnan.dinesh | last post by:
Hi frnds, Here is my secanrio. I have created a table , it seems to be, ~ Table's head part (table headings) will be static , and rest of part (rest of the rows) can be scrolled vertically...
0
by: moustikitos | last post by:
I wrote a scrolled frame for Tkinter : http://bruno.thoorens.free.fr/downloads/scrolled.py I also wrote a Tile wrapper for Python : http://bruno.thoorens.free.fr/downloads/ttk.html...
3
ilikepython
by: ilikepython | last post by:
I have a class that I use for a scrolled list. The problem is I want to be able to scroll the list using the mouse wheel. I am using bind and it's not working: class ScrolledList(Frame): def...
1
by: Simon | last post by:
Dear reader, I have two forms, FormMain and FormX. FormX will be open as a popup in front of FormMain. By selection a field in FormMain, FormX drops to the back of FormMain.
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.