Re: RichEdit limits

new topic     » goto parent     » topic index » view thread      » older message » newer message

I had same problem and wrote this function:

global constant EM_GETLIMITTEXT         = #00D5
global constant EM_CHARFROMPOS          = #00D7

--// manages EM_GETLIMITTEXT and EM_SETLIMITTEXT
--// and replaces special (unwanted) characters.
--// 
--// Note: text should really be read in text mode, not binary,
--//    because for example EM_CHARFROMPOS doesn't work correct otherwise.
global procedure edittext_settext (integer id, sequence text)
    atom limit
    --//
    --// replace some special characters
    --//=>
        for i = 1 to length (text) do
            --//
            --// repalce 0's with .'s
            --// because edit control treats 0's as end of file:
            --//=>
                if text [i] = 0 then
                    text [i] = '.'
                end if
            --//
            --// newline binary/text mode nightmare :*) :
            --//=>
                if i < length (text) then
                    if text [i] = #0D and text [i + 1] = #0D then
                        text [i] = ' '
                    end if
                else
                    if i >= 2 then
if text [i] = #0A and text [i - 1] = #0A then
                            text [i] = ' '
                        end if
                    end if
                end if
        end for
    --//
    --// expand memory of edit control if needed:
    --//=>
        limit = sendMessage (id, EM_GETLIMITTEXT, 0, 0)
        if length (text) + 1000 >= limit then
            Void = sendMessage (id, EM_SETLIMITTEXT, length (text) + 1000, 0)
        end if
    --//
    --// set text:
    --//=>
        setText (id, text)
end procedure


unknown wrote:
> 
> The "long.exw" demo for the Win32Lib shows how a long file could be loaded
> into the
> RichEdit window.
> 
> But the problem I met is that a long file cannot be edited but shortened,
> since it
> is not allowed to enter any character beyond the [64k or the] current length
> of the
> file.
> 
> This problem does not arise with TextEdit mode. Is there any parameter or flag
> or mode
> that can overcome this limitation, a part the primitive trick to load first a
> longer
> code into the same window?
> I still use the Win32Lib 59-1.
> 
> Thanks
> 
> Antonio
> 
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu