Re: Questions!

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

Travis wrote:

> 2.  RichEdit
> Trying to use RichEdit, I was unable to open any
> file and put it into the RichEdit component if
> that file was larger than ~3k.  To attempt this,
> I used a slightly modified version of the sample
> program RichEdit.exw, which I've included below.
> The reason that I was wanting to use RichEdit in
> the IDE was to give it the capability of opening
> files larger than 32k.  To have a size limit that
> low, I'm pretty sure that the problem here isn't
> with the tool, but with the operator.  If someone
> could find my boo-boo, it would be much
> appreciated.

The problem seems to have been with the Win32 help file regarding the stream
callback function (see putStreamCallback() in win32lib), which states:

"The return value depends on direction. If data is streaming in, the return
value is the number of bytes copied to the buffer, or zero if the transfer
is complete."

MSDN states:

"The callback function returns zero to indicate success.
The callback function returns a nonzero value to indicate an error. If an
error occurs, the read or write operation ends and the rich edit control
discards any data in the pbBuff buffer. If the callback function returns a
nonzero value, the rich edit control uses the dwError member of the
EDITSTREAM structure to pass the value back to the application."

The latter is what seems to actually work.  So, the following is what
putStreamCallback() should really look like (I just took out retval, and
made it return 0 every time):

function putStreamCallback(atom dwCookie, atom pbBuff, atom cb,
    atom pcb )

    atom bytes

    if cb > length(stream) then
        bytes = length( stream )
    else
        bytes = cb
    end if
    poke4( pcb, bytes )

    poke( pbBuff, stream[1..bytes] )
    stream = stream[bytes+1..length(stream)]

    return 0
end function
constant pscb = call_back( routine_id( "putStreamCallback" ) )) )

Derek, please make this change on the sourceforge end.

--Matt Lewis

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

Search



Quick Links

User menu

Not signed in.

Misc Menu