473,800 Members | 2,523 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.appen d("my text");
mytextbox.focus ();
mytextbox.scrol ltocaret();

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 2662
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.appen d("my text");
mytextbox.focus ();
mytextbox.scrol ltocaret();

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.co m

"John B" <jb******@yahoo .comwrote in message
news:T8******** **********@nasa l.pacific.net.a u...
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.appe nd("my text");
mytextbox.focu s();
mytextbox.scro lltocaret();

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.guar d.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.c om

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

news:T8******** **********@nasa l.pacific.net.a u...
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.appen d("my text");
mytextbox.focus ();
mytextbox.scrol ltocaret();
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
"sherifffruitfl y" <sh************ *@gmail.comwrot e in message
news:11******** **************@ d57g2000hsg.goo glegroups.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.jondavi s.net>
wrote:
"sherifffruitfl y" <sherifffruit.. .@gmail.comwrot e in message

news:11******** **************@ d57g2000hsg.goo glegroups.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
1145
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
1450
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 something (for example a label) out side of visible part. When in design mode there is no problem, scrollbars automatically appears and works fine, but when i run (deploy) the
1
5304
by: Fei Li | last post by:
For me, it is absolutely necessary.
0
2156
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 appears. I'd like to disable it but don't know how. I understand there to be an "HScroll" property but it's protected and I don't know how to get at it. Any ideas? --
5
3291
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
1520
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 quick and easy way to at least get it working for now. I tried to keep this short, but I couldn't find a way to. The control has its Autoscroll property set to true. It contains a PictureBox at 0,0 with its SizeMode set to StretchImage. When...
2
3810
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(); this.AutoScroll=false; }
0
1952
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 want to stop default scrollmoving property of panel,so that i can use this event for my picturebox. I donot want to set its autoscroll to false,i want panel's scrollbar to be visible ,but they should'nt function when i scroll mousewheel on
1
3393
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 can’t find the AutoScroll property. Do I need to set something up for this property? Any help would be appreciated. -- thank You
0
9550
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10501
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10273
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10250
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10032
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7574
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.