Modify

Opened 10 years ago

Closed 10 years ago

#2874 closed Bug (Fixed)

_GUICtrlRichEdit_SetCharColor

Reported by: mLipok Owned by: Jpm
Milestone: 3.3.13.20 Component: Standard UDFs
Version: 3.3.10.2 Severity: None
Keywords: Cc:

Description

the same problem like HERE:
https://www.autoitscript.com/trac/autoit/ticket/2700

REPRO:

;~ http://www.autoitscript.com/forum/topic/161043-clear-way-to-show-lines-in-richedit-for-code-like-scite/

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#include <GuiRichEdit.au3>


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$sText = _
        "ABCD" & @CRLF & _
        "EEEE" & @CRLF & _
        "AAAA" & @CRLF & _
        ""

$hRichEdit = _GUICtrlRichEdit_Create($Form1, "", 100, 100, 150, 150)
_Magic($hRichEdit, $sText)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Func _Magic(ByRef $hRichEdit, $sText)
    Local $aTextTemp = StringSplit($sText, @CRLF, 1)

    For $i = 1 To $aTextTemp[0]
        _GUICtrlRichEdit_SetSel($hRichEdit,-1,-1)
        Sleep(100) ; this can be removed
        _GUICtrlRichEdit_SetCharColor($hRichEdit, Dec("00FF00"))
        Sleep(100); this can be removed
        _GUICtrlRichEdit_InsertText($hRichEdit, $i)
        Sleep(100); this can be removed
        _GUICtrlRichEdit_SetSel($hRichEdit,-1,-1)
        Sleep(100); this can be removed
        _GUICtrlRichEdit_SetCharColor($hRichEdit, Dec("000000"))
        Sleep(100); this can be removed
        _GUICtrlRichEdit_InsertText($hRichEdit, " " & $aTextTemp[$i] & @CRLF)
        Sleep(100); this can be removed
    Next

EndFunc   ;==>_Magic

SOLUTION:
change this:

If $ai[0] = $ai[1] Then
	Return _SendMessage($hWnd, $EM_SETCHARFORMAT, $SCF_ALL, $tCharFormat, 0, "wparam", "struct*") <> 0
Else
	Return _SendMessage($hWnd, $EM_SETCHARFORMAT, $SCF_SELECTION, $tCharFormat, 0, "wparam", "struct*") <> 0
EndIf

to this:

	Return _SendMessage($hWnd, $EM_SETCHARFORMAT, $SCF_SELECTION, $tCharFormat, 0, "wparam", "struct*") <> 0

Attachments (0)

Change History (2)

comment:1 Changed 10 years ago by mLipok

and in HelpFile there is:

Sets the color of selected text or, if none selected, sets the background color of text inserted at the insertion point

but word background should be removed.

comment:2 Changed 10 years ago by Jpm

  • Milestone set to 3.3.13.20
  • Owner set to Jpm
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [11053] in version: 3.3.13.20

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 closed The owner will remain Jpm.
Author


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

 
Note: See TracTickets for help on using tickets.