1. RichEdit bugs and problems

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

new topic     » topic index » view message » categorize

2. Re: RichEdit bugs and problems

Hello John,
----- Original Message -----
From: <jparav at unipi.gr>
To: "EUforum" <EUforum at topica.com>
Subject: RichEdit bugs and problems


>
> > -- 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.

I'll work on this one. Thanks for the enhancement idea.

> > 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)

This was noted earlier and has been corrected in the next version.

> > 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 !!!
> >

The getText and getRichText has been rewritten and now returns all the text.
The getStream also had a bug and this is fixed in the next version.

The fix to getStream is to replace the getStreamCallback function with this
...

    stream &= peek( {pbBuff, cb} )
    poke4( pcb, cb )
    return  0
end function

But to the Greek aspect. Are you using unicode characters or some other
codepage mapping?
It always returns the correct characters for me but I'm only using the
standard ASCII character set.

------
Derek Parnell
Melbourne, Australia
"To finish a job quickly, go slower."

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu