Modify

Opened 12 years ago

Closed 12 years ago

#2874 closed Bug (Fixed)

_GUICtrlRichEdit_SetCharColor

Reported by: mLipok Owned by: J-Paul Mesnage
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 by mLipok, 12 years ago

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 by J-Paul Mesnage, 12 years ago

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

Fixed by revision [11053] in version: 3.3.13.20

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.