News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Rich Edit with text modes

Started by tomkane, July 22, 2006, 07:52:16 PM

Previous topic - Next topic

tomkane

This is an update to Iczellion's original tutorial 33 on Rich Edit functionality in Windows.

I wanted to add different text modes within the Rich Edit control as I had never seen any other example source code do that sort of thing.

If you run the program first, you will see a new menu option called Text Mode. If you click on it, a popup menu will give you options for 4 text modes:

+ normal (black font);
+ strike (adds a strike-through and text is in red);
+ underline (underlines text and text is in blue); and
+ protected (sets a block of text to protected and text is in green).

Everything works fine for switching modes back and forth between normal, strike, and underline.

When working with protected mode, however, although the text will turn green, when I attempt to change the text, changes are allowed and no warning messaage is given.

The Windows API manual indicates that, when an attempt is made to change a protected area of text in a Rich Edit control, a WM_NOTIFY message is sent with EN_PROTECTED as the submessage.

I have monitored the messages and have never seen the WM_NOTIFY message come through after protected text is set on text.

I am curious to hear if anyone has any suggestions. Thanks for any feedback.

[attachment deleted by admin]

ToutEnMasm

Hello,
You can add manything at it,polices ,color of the backgroun of the line ,of caracteres...
Have a look http://perso.orange.fr/luce.yves/Editmasm.htm
The menu "Format du texte" will give you some answers.
                                            ToutEnMasm

tomkane

Tout,

Pardonnez-moi, ma Francais est tres mal. Desolet. :red

ToutEnMasm


:bg
I was not trying to make a joke but there is something that you don't know.
My IDE as a code explorer that is not as perfect as the C++ one,But.....
The source is included in the package,dowload it and use it to open the source.
"Gestion des projets" --->"ouvrir" .When open,you have a treeview with "explorer" as title,open the tree at the key editmasm.rc,open the tree menu "Format texte",Double clic one of the element menu and you are in the source where the command is send.
Then right clic on the proc that is invoked,and you are in the proc that do the job.
Don't read the comment,That all.
                             ToutEnmasm
                                   

tomkane

ToutEnmasm,

I downloaded the file, extracted, installed and attempted to run it. My system failed to load the full module since there were not enough resources. Alas, I am falling behind ... my development machine is running Windows 98. I'm sure I'll have to upgrade someday soon.

I was able to see a very tiny menu-bar in the upper left corner of my screen. I opened it and got the treeview, found editmasm.rc, and eventually found "Format du Texte". I double clicked on many of the elements under it and got nothing. But I did find a reference to IDM_CHOOSEF, and that had a menu option of "Police", which I guess translates to "Protected" in English.

I tried to search around for text that had references to IDM_CHOOSEF.

What I am looking for is for an example that uses EM_SETCHARFORMAT to establish that the selected text or newly typed text will be protected. I have to load the CHARFORMAT struct loaded with the following flags: CFM_PROTECTED and CFE_PROTECTED.

I welcome any more suggestions. Merci beaucoup.

tomkane

ToutEnmasm et tout le monde (everyone),

I finally remembered to check MSDN. I always do that AFTER I post my problems. The solution depends upon sending ENM_PROTECTED as a mask element through the EM_SETEVENTMASK message:

      invoke SendMessage,hwndRichEdit,EM_SETEVENTMASK ,0,ENM_PROTECTED

Other notification mask elements can be OR'd in.

I will enhance my code with preventive steps that disallow changes to the protected text and upload it tomorrow.

Again, thanks for your help, ToutEnmasm.

tomkane

I've completed the coding for dealing with protected sections of text. As I mentioned, the secret is in setting the event mask. I'm including the code and executable here. I welcome any further suggestions. :dance:

[attachment deleted by admin]