473,652 Members | 2,935 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RichTextBox

How can I tell if the Insert Mode is on or off?

--
Dennis in Houston
Nov 21 '05 #1
8 2175
Insert Mode ????
i am not sure if i exactly understand what you mean with this ..

however if you mean with this the possibility to enter or copy paste data in
the richtextbox control then it is reading out the ReadOnly property
regards

Michel in Rotterdam ;-)

Michel Posseth ,


"Dennis" <De****@discuss ions.microsoft. com> wrote in message
news:59******** *************** ***********@mic rosoft.com...
How can I tell if the Insert Mode is on or off?

--
Dennis in Houston

Nov 21 '05 #2
> How can I tell if the Insert Mode is on or off?

No way that I am aware of. I wish you could, and I wish MS would change the
insertion caret so users would know as well. Ditto for ordinary textboxes.
This is an easy thing for MS to do, and many years have gone by with this
suggestion offered by many people.
Nov 21 '05 #3
Thanks. I guess one has to track the Insert key and toggle a static or
global variable to track the Insert Key presses. MIcrosoft never was one to
add the finer points to their elementary controls...cont rols are not one of
their strong points.
--
Dennis in Houston
"AMercer" wrote:
How can I tell if the Insert Mode is on or off?


No way that I am aware of. I wish you could, and I wish MS would change the
insertion caret so users would know as well. Ditto for ordinary textboxes.
This is an easy thing for MS to do, and many years have gone by with this
suggestion offered by many people.

Nov 21 '05 #4
still don`t understand exactly what you mean :-)
but detecting if the insert key is pressed
can be done with the imessagefilter

i would still like to know what you mean with " Insert Mode is on or off? "
( i might be learning something :-)

regrds

Michel Posseth

"Dennis" <De****@discuss ions.microsoft. com> wrote in message
news:A2******** *************** ***********@mic rosoft.com...
Thanks. I guess one has to track the Insert key and toggle a static or
global variable to track the Insert Key presses. MIcrosoft never was one
to
add the finer points to their elementary controls...cont rols are not one
of
their strong points.
--
Dennis in Houston
"AMercer" wrote:
> How can I tell if the Insert Mode is on or off?


No way that I am aware of. I wish you could, and I wish MS would change
the
insertion caret so users would know as well. Ditto for ordinary
textboxes.
This is an easy thing for MS to do, and many years have gone by with this
suggestion offered by many people.

Nov 21 '05 #5
aha :-)
Most text editors and word processors have two text entry modes from which
you can choose. In insert mode, the editor inserts all characters you type
at the cursor position (or to the right of the insertion point). With each
new insertion, the editor pushes over characters to the right of the cursor
or pointer to make room for the new character.
If insert mode is turned off, the editor overwrites existing characters
instead of inserting the new ones before the old ones. This is often called
overstrike (or overwrite) mode. Most PC keyboards have an Ins key that lets
you switch back and forth between insert and overwrite modes.

For most programs, the default text entry mode is insert mode.


stupid me ,, ofcourse ;-)


"m.posseth" <mi*****@nohaus ystems.nl> wrote in message
news:ef******** *****@TK2MSFTNG P14.phx.gbl...
still don`t understand exactly what you mean :-)
but detecting if the insert key is pressed
can be done with the imessagefilter

i would still like to know what you mean with " Insert Mode is on or off?
" ( i might be learning something :-)

regrds

Michel Posseth

"Dennis" <De****@discuss ions.microsoft. com> wrote in message
news:A2******** *************** ***********@mic rosoft.com...
Thanks. I guess one has to track the Insert key and toggle a static or
global variable to track the Insert Key presses. MIcrosoft never was one
to
add the finer points to their elementary controls...cont rols are not one
of
their strong points.
--
Dennis in Houston
"AMercer" wrote:
> How can I tell if the Insert Mode is on or off?

No way that I am aware of. I wish you could, and I wish MS would change
the
insertion caret so users would know as well. Ditto for ordinary
textboxes.
This is an easy thing for MS to do, and many years have gone by with
this
suggestion offered by many people.


Nov 21 '05 #6

well it seems pretty easy ,,,,

if the richtextbox is created the mode is alway insert , if the focus is on
the richtextbox ( carret is there blinking ) and the insert button is
pressed the mode changes to overwrite so trap the messages and you know what
the status is
did some testing ,, and this seems to work fine ( throw a richtextbox on a
form and copy paste below code )

Implements IMessageFilter

Private rtGotfocus As Boolean = True, rtInsert As Boolean = True, rtInsDwn
As Boolean = True

Public Event rtInsertStateCh anged(ByVal insert As Boolean)

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

Application.Add MessageFilter(M e)

AddHandler rtInsertStateCh anged, AddressOf rtStateChange

rtStateChange(T rue)

End Sub

Sub rtStateChange(B yVal insert As Boolean)

Label1.Text = " Status : " & CStr(IIf(insert , " Insert ", " Overwrite "))

End Sub

Public Function PreFilterMessag e(ByRef m As System.Windows. Forms.Message) _

As Boolean Implements IMessageFilter. PreFilterMessag e

Dim keyCode As Keys = CType(m.WParam. ToInt32(), Keys) And Keys.KeyCode

If rtGotfocus AndAlso (keyCode = Keys.Insert) Then

If rtInsDwn Then

rtInsert = Not rtInsert

RaiseEvent rtInsertStateCh anged(rtInsert)

End If

rtInsDwn = Not rtInsDwn

End If

End Function

Private Sub RichTextBox1_Go tFocus(ByVal sender As Object, ByVal e As
System.EventArg s) Handles RichTextBox1.Go tFocus

rtGotfocus = True

End Sub

Private Sub RichTextBox1_Lo stFocus(ByVal sender As Object, ByVal e As
System.EventArg s) Handles RichTextBox1.Lo stFocus

rtGotfocus = False

End Sub

End Class


"m.posseth" <mi*****@nohaus ystems.nl> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
aha :-)
Most text editors and word processors have two text entry modes from which
you can choose. In insert mode, the editor inserts all characters you type
at the cursor position (or to the right of the insertion point). With each
new insertion, the editor pushes over characters to the right of the
cursor or pointer to make room for the new character.
If insert mode is turned off, the editor overwrites existing characters
instead of inserting the new ones before the old ones. This is often
called overstrike (or overwrite) mode. Most PC keyboards have an Ins key
that lets you switch back and forth between insert and overwrite modes.

For most programs, the default text entry mode is insert mode.


stupid me ,, ofcourse ;-)


"m.posseth" <mi*****@nohaus ystems.nl> wrote in message
news:ef******** *****@TK2MSFTNG P14.phx.gbl...
still don`t understand exactly what you mean :-)
but detecting if the insert key is pressed
can be done with the imessagefilter

i would still like to know what you mean with " Insert Mode is on or
off? " ( i might be learning something :-)

regrds

Michel Posseth

"Dennis" <De****@discuss ions.microsoft. com> wrote in message
news:A2******** *************** ***********@mic rosoft.com...
Thanks. I guess one has to track the Insert key and toggle a static or
global variable to track the Insert Key presses. MIcrosoft never was
one to
add the finer points to their elementary controls...cont rols are not one
of
their strong points.
--
Dennis in Houston
"AMercer" wrote:

> How can I tell if the Insert Mode is on or off?

No way that I am aware of. I wish you could, and I wish MS would
change the
insertion caret so users would know as well. Ditto for ordinary
textboxes.
This is an easy thing for MS to do, and many years have gone by with
this
suggestion offered by many people.



Nov 21 '05 #7
Thanks for the code...it's what I needed. However, it would be a lot easier
if M'soft had included a Property in the edit controls that returned the
"Overstrike " mode as True or False and maybe even an "OverstrikeMode Changed"
event. It's a feature that several people have ask for and would seem to be
very trivial for Microsoft to implement in their controls that have edit
features.
--
Dennis in Houston
"m.posseth" wrote:

well it seems pretty easy ,,,,

if the richtextbox is created the mode is alway insert , if the focus is on
the richtextbox ( carret is there blinking ) and the insert button is
pressed the mode changes to overwrite so trap the messages and you know what
the status is
did some testing ,, and this seems to work fine ( throw a richtextbox on a
form and copy paste below code )

Implements IMessageFilter

Private rtGotfocus As Boolean = True, rtInsert As Boolean = True, rtInsDwn
As Boolean = True

Public Event rtInsertStateCh anged(ByVal insert As Boolean)

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

Application.Add MessageFilter(M e)

AddHandler rtInsertStateCh anged, AddressOf rtStateChange

rtStateChange(T rue)

End Sub

Sub rtStateChange(B yVal insert As Boolean)

Label1.Text = " Status : " & CStr(IIf(insert , " Insert ", " Overwrite "))

End Sub

Public Function PreFilterMessag e(ByRef m As System.Windows. Forms.Message) _

As Boolean Implements IMessageFilter. PreFilterMessag e

Dim keyCode As Keys = CType(m.WParam. ToInt32(), Keys) And Keys.KeyCode

If rtGotfocus AndAlso (keyCode = Keys.Insert) Then

If rtInsDwn Then

rtInsert = Not rtInsert

RaiseEvent rtInsertStateCh anged(rtInsert)

End If

rtInsDwn = Not rtInsDwn

End If

End Function

Private Sub RichTextBox1_Go tFocus(ByVal sender As Object, ByVal e As
System.EventArg s) Handles RichTextBox1.Go tFocus

rtGotfocus = True

End Sub

Private Sub RichTextBox1_Lo stFocus(ByVal sender As Object, ByVal e As
System.EventArg s) Handles RichTextBox1.Lo stFocus

rtGotfocus = False

End Sub

End Class


"m.posseth" <mi*****@nohaus ystems.nl> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
aha :-)
Most text editors and word processors have two text entry modes from which
you can choose. In insert mode, the editor inserts all characters you type
at the cursor position (or to the right of the insertion point). With each
new insertion, the editor pushes over characters to the right of the
cursor or pointer to make room for the new character.
If insert mode is turned off, the editor overwrites existing characters
instead of inserting the new ones before the old ones. This is often
called overstrike (or overwrite) mode. Most PC keyboards have an Ins key
that lets you switch back and forth between insert and overwrite modes.

For most programs, the default text entry mode is insert mode.


stupid me ,, ofcourse ;-)


"m.posseth" <mi*****@nohaus ystems.nl> wrote in message
news:ef******** *****@TK2MSFTNG P14.phx.gbl...
still don`t understand exactly what you mean :-)
but detecting if the insert key is pressed
can be done with the imessagefilter

i would still like to know what you mean with " Insert Mode is on or
off? " ( i might be learning something :-)

regrds

Michel Posseth

"Dennis" <De****@discuss ions.microsoft. com> wrote in message
news:A2******** *************** ***********@mic rosoft.com...
Thanks. I guess one has to track the Insert key and toggle a static or
global variable to track the Insert Key presses. MIcrosoft never was
one to
add the finer points to their elementary controls...cont rols are not one
of
their strong points.
--
Dennis in Houston
"AMercer" wrote:

> > How can I tell if the Insert Mode is on or off?
>
> No way that I am aware of. I wish you could, and I wish MS would
> change the
> insertion caret so users would know as well. Ditto for ordinary
> textboxes.
> This is an easy thing for MS to do, and many years have gone by with
> this
> suggestion offered by many people.



Nov 21 '05 #8
Indeed it would be a lot easier,,,,

for me it is always a sport to solve problems like this , in some sort of
way i even enjoy it ;-)

By the way with the imessagefilter i could solve lots of problems were in
the past ( VB6 ) i needed to do some fancy API calling or subclassing
i used it the first time for trapping webbrowser events
http://www.freevbcode.com/ShowCode.Asp?ID=5635

Investigate it some more and you will see that you will use this code more
frequent to solve those few things that MS "forgot"

Regards

Michel Posseth

"Dennis" <De****@discuss ions.microsoft. com> wrote in message
news:41******** *************** ***********@mic rosoft.com...
Thanks for the code...it's what I needed. However, it would be a lot
easier
if M'soft had included a Property in the edit controls that returned the
"Overstrike " mode as True or False and maybe even an
"OverstrikeMode Changed"
event. It's a feature that several people have ask for and would seem to
be
very trivial for Microsoft to implement in their controls that have edit
features.
--
Dennis in Houston
"m.posseth" wrote:

well it seems pretty easy ,,,,

if the richtextbox is created the mode is alway insert , if the focus is
on
the richtextbox ( carret is there blinking ) and the insert button is
pressed the mode changes to overwrite so trap the messages and you know
what
the status is
did some testing ,, and this seems to work fine ( throw a richtextbox on
a
form and copy paste below code )

Implements IMessageFilter

Private rtGotfocus As Boolean = True, rtInsert As Boolean = True,
rtInsDwn
As Boolean = True

Public Event rtInsertStateCh anged(ByVal insert As Boolean)

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

Application.Add MessageFilter(M e)

AddHandler rtInsertStateCh anged, AddressOf rtStateChange

rtStateChange(T rue)

End Sub

Sub rtStateChange(B yVal insert As Boolean)

Label1.Text = " Status : " & CStr(IIf(insert , " Insert ", " Overwrite "))

End Sub

Public Function PreFilterMessag e(ByRef m As System.Windows. Forms.Message)
_

As Boolean Implements IMessageFilter. PreFilterMessag e

Dim keyCode As Keys = CType(m.WParam. ToInt32(), Keys) And Keys.KeyCode

If rtGotfocus AndAlso (keyCode = Keys.Insert) Then

If rtInsDwn Then

rtInsert = Not rtInsert

RaiseEvent rtInsertStateCh anged(rtInsert)

End If

rtInsDwn = Not rtInsDwn

End If

End Function

Private Sub RichTextBox1_Go tFocus(ByVal sender As Object, ByVal e As
System.EventArg s) Handles RichTextBox1.Go tFocus

rtGotfocus = True

End Sub

Private Sub RichTextBox1_Lo stFocus(ByVal sender As Object, ByVal e As
System.EventArg s) Handles RichTextBox1.Lo stFocus

rtGotfocus = False

End Sub

End Class


"m.posseth" <mi*****@nohaus ystems.nl> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
> aha :-)
>
>
> Most text editors and word processors have two text entry modes from
> which
> you can choose. In insert mode, the editor inserts all characters you
> type
> at the cursor position (or to the right of the insertion point). With
> each
> new insertion, the editor pushes over characters to the right of the
> cursor or pointer to make room for the new character.
> If insert mode is turned off, the editor overwrites existing characters
> instead of inserting the new ones before the old ones. This is often
> called overstrike (or overwrite) mode. Most PC keyboards have an Ins
> key
> that lets you switch back and forth between insert and overwrite modes.
>
> For most programs, the default text entry mode is insert mode.
>
>
>
>
> stupid me ,, ofcourse ;-)
>
>
>
>
> "m.posseth" <mi*****@nohaus ystems.nl> wrote in message
> news:ef******** *****@TK2MSFTNG P14.phx.gbl...
>> still don`t understand exactly what you mean :-)
>>
>>
>> but detecting if the insert key is pressed
>> can be done with the imessagefilter
>>
>> i would still like to know what you mean with " Insert Mode is on or
>> off? " ( i might be learning something :-)
>>
>> regrds
>>
>> Michel Posseth
>>
>>
>>
>> "Dennis" <De****@discuss ions.microsoft. com> wrote in message
>> news:A2******** *************** ***********@mic rosoft.com...
>>> Thanks. I guess one has to track the Insert key and toggle a static
>>> or
>>> global variable to track the Insert Key presses. MIcrosoft never was
>>> one to
>>> add the finer points to their elementary controls...cont rols are not
>>> one
>>> of
>>> their strong points.
>>> --
>>> Dennis in Houston
>>>
>>>
>>> "AMercer" wrote:
>>>
>>>> > How can I tell if the Insert Mode is on or off?
>>>>
>>>> No way that I am aware of. I wish you could, and I wish MS would
>>>> change the
>>>> insertion caret so users would know as well. Ditto for ordinary
>>>> textboxes.
>>>> This is an easy thing for MS to do, and many years have gone by with
>>>> this
>>>> suggestion offered by many people.
>>
>>
>
>


Nov 21 '05 #9

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

Similar topics

0
3229
by: nouno | last post by:
I am trying to spell check a richtextbox. Through code (shown below) I save the contents of the richtextbox to a rtf file, open the rtf file in Word, spell check it, save it, and then load the ftf file back into the ricktextbox using loadfile. The problem is that the richtextbox seems to remain bound to the rtf file. If I make a change in the richtextbox after spell checking, the changes are successfully saved to the database but if the...
3
21118
by: kangoo | last post by:
Hi, I'm trying to remove the last charater in a richTextBox. I though richTextBox.Text.Remove(richTextBox.Text.length-1, 1); would work, but it does nothing (eg richTextBox.Text += "some new text"; works) Thanks for your attention & solutions
1
2486
by: Nathan Carroll | last post by:
In an mdi environment I constructed a child for with a richtextbox control that is used to load .rtf's. This works fine on the intiatial load of the form but when for is closed and reopened later I get: System.ObjectDisposedException: Cannot access a disposed object named "RichTextBox". Object name: "RichTextBox". at System.Windows.Forms.Control.CreateHandle() at System.Windows.Forms.TextBoxBase.CreateHandle() at...
12
2163
by: M O J O | last post by:
Hi, If I inside a thread creates a RichTextBox and only use this inside the thread, will there be any thread problems? I need to convert between Text and RTF inside a thread. Thanks!! M O J O
2
17335
by: JonnyT | last post by:
I searched high and low for an answer on how to auto scroll a richtextbox and now I finally have it. Since it took me a while to get a good efficient way of doing it that didn't require focus to the control or the scrolltocaret method I decided that it would be worth posting to anyone who might have similar concerns. For the record this works well in an environment where you cannot have focus going to the richtextbox....such as a chat...
0
11141
by: Vincent | last post by:
Dear all, I have implemented a class to export the content of RichTextBox to image in WYSISYG mode so that line breaks on the screen are the same as exported. C# Code: public struct STRUCT_RECT
9
4860
by: James Wong | last post by:
Hi, I use the RichTextBox in my program. It will use different language in this RichTextBox (chinese and english characters), and it set the "DualFont" and use different fonts. By the way, how can I print out this content to printer easily? Thanks! James
3
7172
by: michael sorens | last post by:
The documentation for the RichTextBox is sketchy at best. I want to do a very simple task but I cannot find information on this. I am using a RichTextBox as an output window. Some text I want to just add plain (e.g.. rtf.Text += "new stuff..."; ) but some text, when added, I want to be in a different color or font size. Find() will not work because the text will vary. I have delimiters on it so I could recognize it with a regular ...
0
2052
by: Vimalathithan | last post by:
I just developing a editor. I have provide the options like Bold, Italic, underlin, font change, font size change. These font options are keep in with one toolstripbutton. the toolstripbar keep inside with panel. The RichTextBox keep inside with other panel. The panel height and width is same with RichTextBox. The RichTextBox both scrolling options are make it as false. I done the coding for RichTextBox's height to fit with...
1
1700
by: bmerlover | last post by:
I'm having trouble reading quotations inside the richTextBox when a file is opened on to it. I've tried a couple different methods, most of them didn't compile. I came across one that does compile and supposedly it's suppose to work but it doesn't in my case. I tried this code to see if it would recognize the quotations. For testing purpose I wanted to see if it would start the string from the quotation. str =...
0
8370
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8283
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
8811
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...
1
6160
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
5620
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4147
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...
0
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2707
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.