RichEdit bugs and problems
- Posted by jparav at unipi.gr
Jul 02, 2001
First, a general comment on Win32Lib (sorry about the format of the
following lines - I just pasted them from various codes I am toying with,
here and there).
> -- Important omission in Win32Lib:
> -- ==============================
> -- No capability to add CTRL-key combinations in menus
> -- so that CTRL key combinations appear properly right-aligned
> -- when menus are pulled down.
>
> Perhaps the team that gave us Win32Lib can consider adding this capability.
>
> Now, on the infamous RichEdit control that I have been trying to use in my
> very simple HTML editor. At first, a bug in the present version of Win32Lib:
>
> -- Following line does NOT really allow you to set the limit above 64 Kb:
> -- LimitText(textBox, 1000000 ) -- textBox is a RICHEDIT CONTROL
> -- because Win32Lim passes arguments in the wrong way:
> -- VOID=sendMessage(id,lMsgType,pSize,NULL)
> -- while in fact they should be in the following sequence:
> -- VOID=sendMessage(id,lMsgType,NULL,pSize)
> -- The error occurs because the LimitText routine
> -- tries to use the same formula for both EM_LIMITTEXT and
> EM_EXLIMITTEXT.
> -- while in fact the positioning of NULL and pSize is
> -- different in the two messages !!!
> --
> -- So, until Win32Lib is corrected, EM_EXLIMITTEXT should be used
> -- when the desired size is > 64 Kb:
> -- result = sendMessage(textBox, EM_EXLIMITTEXT, 0,1000000)
>
> Finally, the most important problems in using RichEdit controls properly:
>
> -- PROBLEMS:
>
> -- It is not possible to read all the contents of a RichEdit control
> properly.
> -- There are 4 methods, each one with problems as explained below.
> --
> -- 1. If I use getText(textBox), preceded by, say,
> -- result = sendMessage(textBox, EM_SETSEL, 0, 1000)
> -- (to select the first 1000 characters)
> -- all selected text is copied *but* Greek (POSSIBLY OTHER INTERNATIONAL)
> characters
> -- are mangled.
> --
> -- 2. If I use getRichText(textBox,{0,0}), all text is copied
> -- *but* Greek characters are mangled.
> --
> -- 3. If I use getStream(textBox, StreamRTF), *only* about 12 Kb are copied
> (!!!)
> -- and these are converted to RTF (which is inappropriate for
> -- HTML documents).
> --
> -- 4. If I use getStream(textBox, StreamText), I do obtain simple text with
> -- Greek characters maintained properly *but* only about 2 Kb are copied
> !!!
> -- All in all this is the most promising method *BUT* I cannot make it
> -- to copy the entire contents of the RTF edit !!!
>
> I became aware of these problems because, contrary to simplistic text
> editors (such as generic.exw), I am trying to put together a RichEdit based
> editor that needs to actually READ IN the code contained in the RichEdit,
> change it and WRITE IT back to the control. Well, if you read the above
<snip>
Best regards to everybody on the forum.
John Paravantis
University of Piraeus
Greece
|
Not Categorized, Please Help
|
|