473,406 Members | 2,217 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,406 software developers and data experts.

How to derive from textbox to get an autoscroll property?

Hi,

I want to derive of of TextBox, and add on an auto-scroll-to-bottom
boolean property. I can use a regular textbox (rich or otherwise) and
get the effect by:

mytextbox.append("my text");
mytextbox.focus();
mytextbox.scrolltocaret();

What sorts of things do I need to look into in order to get a property
in a derived class that has this effect?

Thanks for any direction,

cdj

Mar 18 '07 #1
5 2644
sherifffruitfly wrote:
Hi,

I want to derive of of TextBox, and add on an auto-scroll-to-bottom
boolean property. I can use a regular textbox (rich or otherwise) and
get the effect by:

mytextbox.append("my text");
mytextbox.focus();
mytextbox.scrolltocaret();

What sorts of things do I need to look into in order to get a property
in a derived class that has this effect?

Thanks for any direction,

cdj
Inherit from textbox, add your property and override OnTextChanged and
do your processing in there.

JB
Mar 19 '07 #2
Additionally, it should be stated that calling the focus method is not
advisable. If I was on another control and the focus was suddenly taken
from me, I'd be pissed.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"John B" <jb******@yahoo.comwrote in message
news:T8******************@nasal.pacific.net.au...
sherifffruitfly wrote:
>Hi,

I want to derive of of TextBox, and add on an auto-scroll-to-bottom
boolean property. I can use a regular textbox (rich or otherwise) and
get the effect by:

mytextbox.append("my text");
mytextbox.focus();
mytextbox.scrolltocaret();

What sorts of things do I need to look into in order to get a property
in a derived class that has this effect?

Thanks for any direction,

cdj

Inherit from textbox, add your property and override OnTextChanged and do
your processing in there.

JB

Mar 19 '07 #3
On Mar 18, 6:02 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Additionally, it should be stated that calling the focus method is not
advisable. If I was on another control and the focus was suddenly taken
from me, I'd be pissed.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"John B" <jbngs...@yahoo.comwrote in message

news:T8******************@nasal.pacific.net.au...
sherifffruitfly wrote:
Hi,
I want to derive of of TextBox, and add on an auto-scroll-to-bottom
boolean property. I can use a regular textbox (rich or otherwise) and
get the effect by:
mytextbox.append("my text");
mytextbox.focus();
mytextbox.scrolltocaret();
What sorts of things do I need to look into in order to get a property
in a derived class that has this effect?
Thanks for any direction,
cdj
Inherit from textbox, add your property and override OnTextChanged and do
your processing in there.
JB
Then I have no idea how to get the textbox to scroll. According to
msdn, the textbox must have focus in order for scrolltocaret to work.
In particular, there simply IS NO CARET unless the textbox has focus.

I'm open to any workaround ideas. (This issue is really why I asked
the question in the first place.)

Mar 19 '07 #4
"sherifffruitfly" <sh*************@gmail.comwrote in message
news:11**********************@d57g2000hsg.googlegr oups.com...
Then I have no idea how to get the textbox to scroll. According to
msdn, the textbox must have focus in order for scrolltocaret to work.
In particular, there simply IS NO CARET unless the textbox has focus.

I'm open to any workaround ideas. (This issue is really why I asked
the question in the first place.)
Yeah. I've run into that before. One more example of why the built-in
controls in Windows Forms are half-baked.

Try using a COM-based textbox. Yeah it's old-school but it's better than
stealing focus...

Jon

Mar 19 '07 #5
On Mar 18, 9:18 pm, "Jon Davis" <j...@REMOVE.ME.PLEASE.jondavis.net>
wrote:
"sherifffruitfly" <sherifffruit...@gmail.comwrote in message

news:11**********************@d57g2000hsg.googlegr oups.com...
Then I have no idea how to get the textbox to scroll. According to
msdn, the textbox must have focus in order for scrolltocaret to work.
In particular, there simply IS NO CARET unless the textbox has focus.
I'm open to any workaround ideas. (This issue is really why I asked
the question in the first place.)

Yeah. I've run into that before. One more example of why the built-in
controls in Windows Forms are half-baked.
Jon
Is there any way to "remember" what object had focus when the textbox
stole it,
and return focus to that object when the and return focus to it when
the textbox
is done scrolling/updating?

Mar 19 '07 #6

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

Similar topics

0
by: Melinda | last post by:
I'm new to .NET and am wondering how to implement autoscroll in a TextBox. Any help would be appreciated. Thanks. Melinda
0
by: Yasin Gedik | last post by:
Hello, I have a problem with autoscroll property. I am designing a form for pocket pc 2003 in whidbey, and deploying it to emulator. I set the forms Autoscroll property true and put...
1
by: Fei Li | last post by:
For me, it is absolutely necessary.
0
by: Robert W. | last post by:
I've successfully implemented AutoScroll capability with one panel and it works great. But with another panel, when AutoScroll is turned on, an annoying & unnecessary horizational scrollbar...
5
by: Frank | last post by:
Hello, if autoscroll is true in a form. Is there a way to detect the scrollbars are active? Thanks Frank
0
by: Jeff | last post by:
I am making a custom control that displays images, allows zooming in and out, and can fit the image to the control. The way I am handling all of this is probably not best, but I was looking for a...
2
by: Just close your eyes and see | last post by:
hi all i am working in a MDI Application , and i want to disable the autoscroll property of the midi parent form, i had used this but it didnt work public Form1() { InitializeComponent();...
0
by: Neeraj | last post by:
Hi I have panel and inside the panel i have many picturebox,if number of picturebox increase ,i have set panel's autoscroll property to true,but as and when i click on any of the picturebox ,i...
1
by: =?Utf-8?B?R3VzIENodWNo?= | last post by:
I’m working on a GroupBox and need to set the AutoScroll property to true. My problem is I have no AutoScroll property listed in the property box. And even if I go in to the Designer.cs file I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.