Modify

#4038 closed Bug (Fixed)

_GUICtrlRichEdit_StreamToFile adds new paragraph at the end on every open to save

Reported by: anonymous Owned by: J-Paul Mesnage
Milestone: 3.3.17.0 Component: Standard UDFs
Version: 3.3.14.0 Severity: None
Keywords: _GUICtrlRichEdit_StreamToFile Cc:

Description

see:

https://www.autoitscript.com/forum/topic/212753-richedit-streamtofile-adds-newline-every-time/

example code + temp solution:

#include <GUIConstants.au3>
#include <GuiRichEdit.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", True)

;~ $__g_pGRC_StreamToFileCallback = DllCallbackRegister("__GCR_StreamToFileCallbackEx", "dword", "long_ptr;ptr;long;ptr")

Example()

Func Example()
  Local $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, StringLen(".exe")) & ")", 320, 350, -1, -1)
  Local $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
      BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
  Local $idBtnIn = GUICtrlCreateButton("In", 270, 310, 40, 30)
  Local $idBtnOut = GUICtrlCreateButton("Out", 170, 310, 40, 30)
  GUISetState(@SW_SHOW)

  _GUICtrlRichEdit_SetText($hRichEdit, "First paragraph")
  While True
    Switch GUIGetMsg()
      Case $GUI_EVENT_CLOSE
        ExitLoop
      Case $idBtnOut
        _GUICtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
      Case $idBtnIn
        _GUICtrlRichEdit_StreamFromFile($hRichEdit, @DesktopDir & "\gcre.rtf")
    EndSwitch
  WEnd
  _GUICtrlRichEdit_Destroy($hRichEdit)
EndFunc   ;==>Example

Attachments (0)

Change History (1)

comment:1 by J-Paul Mesnage, 12 months ago

Milestone: 3.3.17.0
Owner: set to J-Paul Mesnage
Resolution: Fixed
Status: newclosed

Fixed by revision [13094] in version: 3.3.17.0

Modify Ticket

Action
as closed The owner will remain J-Paul Mesnage.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.