473,704 Members | 2,897 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RTF widget and undo disabling (sometimes only)

Hi,

I have successfully created a class derived from the RTF widget that can
syntax highlight XML as fast as you type :-)

The only problem I have is that if the user does an 'undo' then syntax
highlighting is undone. Is it possible to disable the undo stack during
specific operations ?

Jim
Dec 6 '05 #1
4 2453
Jim,

You can override the WndProc method on your control and then handle the
EM_UNDO message (I believe you are using an RichTextBox). You can decide
whether to process this or not.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Random Task" <Ra****@Task.be > wrote in message
news:tr******** ***********@new s20.bellglobal. com...
Hi,

I have successfully created a class derived from the RTF widget that can
syntax highlight XML as fast as you type :-)

The only problem I have is that if the user does an 'undo' then syntax
highlighting is undone. Is it possible to disable the undo stack during
specific operations ?

Jim

Dec 6 '05 #2
Nicholas Paldino [.NET/C# MVP] wrote:
Jim,

You can override the WndProc method on your control and then handle the
EM_UNDO message (I believe you are using an RichTextBox). You can decide
whether to process this or not.

Hope this helps.

I am a newbie to having to write code at this level ... I just tried the
below code and it looks like I can't overide this on the RickTextBox ...

Is there something else i should be trying?

And thanks very much ... everyone normally ignores this question

Jim

public class MyHighlightable : RichTextBox
{
public bool ishighlighting;
public MyHighlightable (): base()
{
}

/*
RichTextBoxSynt axHighligher.cs (29):
'Zeligsoft.Help ers.MyHighlight able.WndProc(re f
Zeligsoft.Helpe rs.Message)': no suitable method found to
override
*/
protected override void WndProc(ref Message message)
{
switch (message.Msg)
{
case (int)Msgs.EM_UN DO:
{
if (ishighlighting )
{
return;
}
else
{
base.WndProc(re f message);
}
break;
}
default:
{
base.WndProc(re f message);
}
}
}

}
Dec 6 '05 #3
Ooops ... some one created a "Message" class in namespace ...

My bad ...
Jim

Random Task wrote:
Nicholas Paldino [.NET/C# MVP] wrote:
Jim,

You can override the WndProc method on your control and then
handle the EM_UNDO message (I believe you are using an RichTextBox).
You can decide whether to process this or not.

Hope this helps.

I am a newbie to having to write code at this level ... I just tried the
below code and it looks like I can't overide this on the RickTextBox ...

Is there something else i should be trying?

And thanks very much ... everyone normally ignores this question

Jim

public class MyHighlightable : RichTextBox
{
public bool ishighlighting;
public MyHighlightable (): base()
{
}

/*
RichTextBoxSynt axHighligher.cs (29):
'Zeligsoft.Help ers.MyHighlight able.WndProc(re f
Zeligsoft.Helpe rs.Message)': no suitable method found to
override
*/
protected override void WndProc(ref Message message)
{
switch (message.Msg)
{
case (int)Msgs.EM_UN DO:
{
if (ishighlighting )
{
return;
}
else
{
base.WndProc(re f message);
}
break;
}
default:
{
base.WndProc(re f message);
}
}
}

}

Dec 7 '05 #4
Nicholas Paldino [.NET/C# MVP] wrote:
Jim,

You can override the WndProc method on your control and then handle the
EM_UNDO message (I believe you are using an RichTextBox). You can decide
whether to process this or not.

Hope this helps.


Thanks for the help ... unfortunately it still doesn't work ... it
appears there is no "disable undo queue" that i can call during the
period of time where i highlight the code in the RTF ... my boss
unfortunately wont let me simply disable undo in the editor :-)

Maybe there are some other ideas ... but like I said your the first to
even offer a suggestion on this :-)

Cheers,
Jim

ps here's the code i tried to catch events ...
/// <summary>
///
/// </summary>
public class MyHighlightable RTF: RichTextBox
{
public bool ishighlighting;

public MyHighlightable RTF(): base()
{

}

protected override void WndProc(ref System.Windows. Forms.Message message)
{
switch (message.Msg)
{
case (int) 0x0304://EM_UNDO:
{
if (ishighlighting )
{
return;
}
else
{
base.WndProc(re f message);
}
break;
}
case (int) 0x00C7:
{
if (ishighlighting )
{
return;
}
else
{
base.WndProc(re f message);
}
break;
};
case (int) 0x00C6: //EM_CANUNDO 0x00C6
{
if (ishighlighting )
{
return;
}
else
{
base.WndProc(re f message);
}
break;
}
case (int) 0x0114://WM_HSCROLL
{
if (ishighlighting )
{
return;
}
else
{
base.WndProc(re f message);
}
break;
}
case 0x0115: //(int)WM_VSCROLL
{
if (ishighlighting )
{
return;
}
else
{
base.WndProc(re f message);
}
break;
}
case 0x00CD: //EM_EMPTYUNDOBUF FER
{
if (ishighlighting )
{
return;
}
else
{
base.WndProc(re f message);
}
break;
}
default:
{
base.WndProc(re f message);
break;
}
}
}

}
Dec 7 '05 #5

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

Similar topics

3
12646
by: Enigman O'Maly | last post by:
I've written, er, that is, recorded and re-written a lot of little useful macros to help me with a spreadsheet dealing with financial investments. Very handy they are, yes, but sometimes I wish I could undo what one of them just screwed up for me. Is there any sort of checkpoint capability I could bodge into the code? The help index doesn't seem to know what that checkpointing means, no surprise, since I dredged it up from my ancient...
3
4927
by: Phil Schmidt | last post by:
I'm trying to make a custom entry widget, as in the code that follows. There are two problems I'm trying to fix: 1) I would like the widget to behave as myEntry.Escape() does now, except that it happens on loss of focus, not when pressing Esc. 2) TABbing between multiple entry fields does undesired things with the selection, and with cursor placement. Can anyone offer any suggestions for how to fix this? I'm attemting to
0
1400
by: John Benson | last post by:
With respect to: Message: 13 Date: Thu, 1 Jan 2004 18:38:47 -0800 (PST) From: black <quiteblack@yahoo.com> Subject: undo and redo ? To: python-list@python.org Message-ID: <20040102023847.78427.qmail@web21326.mail.yahoo.com> Content-Type: text/plain; charset="us-ascii"
3
4503
by: Patrick S | last post by:
I am using IE 6.0. On a page, I have placed a contenteditable div which I want to use as a Rich Text Area. I am using the execCommand method of the document to control bold, italics, underlining, and undo for this div. I have placed an input element on the page to. All but the undo, are restricted to working only on the div. How can I restrict the undo to working on only the div? Below is the complete page so you can see what I am...
4
1936
by: D Witherspoon | last post by:
Sometimes if I build the app I will get intellisense, undo, and code completion (automatic completion of if stataments etc), but after a few lines of code this stops. I lose any code completion I lose all automatic code indentation I loose intellisense If there are errors (squiqqly lines under the code) and I fix them, the blue squiggly line still appears until I rebuid. Rebuild fixes the formatting too.
2
1916
by: Leslie | last post by:
On a form, I create a record and save, and am ready to enter another. I decide to Quit the form which executes an "Undo" in case there is data entered. This then tries to "delete" my just saved record. I want to "Reset" my Undo ability once I've saved a record. Is there a way to reset the Undo? Any help or tips would greatly help. I'm looking for syntax and attachment points.
0
847
by: MumboJumbo | last post by:
RichTextBox ... how do i not add operations on the widget to the undo queue? Jim
5
987
by: Woody Splawn | last post by:
For reasons I have not been able to identify, sometimes I am unable to invoke the undo option when I am in the code viewer. I am using VS.net 2003 (18718). The solution is to exit VB and come back in. When I do, undo is working again but I wish I knew what make is happen in the first place. If I did know perhaps I could avoid the problem. It's kind of irritating. Does anyone know what the problem is? Is it a known bug in this...
1
1649
by: Jeremy | last post by:
I'm working on an application that does some DOM manipulation. I want to add a mechanism for "Undo" so that the user can revert to the previous state after performing a mistaken action. Simple idea, not necessarily simple to implement. My first idea for this is to use closures and an array that tracks the inverse of the user's actions. Here's a simple example in which the user can only remove DOM nodes and then undo the removal...
0
8767
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
9135
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
9026
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
8977
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
7891
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...
0
5931
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
4701
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3135
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
2
2483
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.