473,385 Members | 1,927 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,385 software developers and data experts.

RichTextBox

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

--
Dennis in Houston
Nov 21 '05 #1
8 2148
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****@discussions.microsoft.com> wrote in message
news:59**********************************@microsof t.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...controls 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****@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.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...controls 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*****@nohausystems.nl> wrote in message
news:ef*************@TK2MSFTNGP14.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****@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.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...controls 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 rtInsertStateChanged(ByVal insert As Boolean)

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Application.AddMessageFilter(Me)

AddHandler rtInsertStateChanged, AddressOf rtStateChange

rtStateChange(True)

End Sub

Sub rtStateChange(ByVal insert As Boolean)

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

End Sub

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

As Boolean Implements IMessageFilter.PreFilterMessage

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 rtInsertStateChanged(rtInsert)

End If

rtInsDwn = Not rtInsDwn

End If

End Function

Private Sub RichTextBox1_GotFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles RichTextBox1.GotFocus

rtGotfocus = True

End Sub

Private Sub RichTextBox1_LostFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles RichTextBox1.LostFocus

rtGotfocus = False

End Sub

End Class


"m.posseth" <mi*****@nohausystems.nl> wrote in message
news:%2****************@tk2msftngp13.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*****@nohausystems.nl> wrote in message
news:ef*************@TK2MSFTNGP14.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****@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.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...controls 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 "OverstrikeModeChanged"
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 rtInsertStateChanged(ByVal insert As Boolean)

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Application.AddMessageFilter(Me)

AddHandler rtInsertStateChanged, AddressOf rtStateChange

rtStateChange(True)

End Sub

Sub rtStateChange(ByVal insert As Boolean)

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

End Sub

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

As Boolean Implements IMessageFilter.PreFilterMessage

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 rtInsertStateChanged(rtInsert)

End If

rtInsDwn = Not rtInsDwn

End If

End Function

Private Sub RichTextBox1_GotFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles RichTextBox1.GotFocus

rtGotfocus = True

End Sub

Private Sub RichTextBox1_LostFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles RichTextBox1.LostFocus

rtGotfocus = False

End Sub

End Class


"m.posseth" <mi*****@nohausystems.nl> wrote in message
news:%2****************@tk2msftngp13.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*****@nohausystems.nl> wrote in message
news:ef*************@TK2MSFTNGP14.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****@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.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...controls 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****@discussions.microsoft.com> wrote in message
news:41**********************************@microsof t.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
"OverstrikeModeChanged"
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 rtInsertStateChanged(ByVal insert As Boolean)

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Application.AddMessageFilter(Me)

AddHandler rtInsertStateChanged, AddressOf rtStateChange

rtStateChange(True)

End Sub

Sub rtStateChange(ByVal insert As Boolean)

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

End Sub

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

As Boolean Implements IMessageFilter.PreFilterMessage

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 rtInsertStateChanged(rtInsert)

End If

rtInsDwn = Not rtInsDwn

End If

End Function

Private Sub RichTextBox1_GotFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles RichTextBox1.GotFocus

rtGotfocus = True

End Sub

Private Sub RichTextBox1_LostFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles RichTextBox1.LostFocus

rtGotfocus = False

End Sub

End Class


"m.posseth" <mi*****@nohausystems.nl> wrote in message
news:%2****************@tk2msftngp13.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*****@nohausystems.nl> wrote in message
> news:ef*************@TK2MSFTNGP14.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****@discussions.microsoft.com> wrote in message
>> news:A2**********************************@microsof t.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...controls 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
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...
3
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...
1
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...
12
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...
2
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...
0
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...
9
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...
3
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...
0
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...
1
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
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
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...

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.