Modify

Opened 29 hours ago

#4038 new Bug

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

Reported by: anonymous Owned by:
Milestone: 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 (0)

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as new The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.