Modify

Opened 12 years ago

Closed 12 years ago

#2485 closed Bug (Fixed)

Selection goes invisible after _GUICtrlRichEdit_GetFont

Reported by: ILLBeBack Owned by:
Milestone: Component: Standard UDFs
Version: 3.3.9.21 Severity: None
Keywords: _GUICtrlRichEdit_SetSel Cc:

Description

In a RichEdit control, the selection goes invisible (not the text, the highlighting) after using UDF _GUICtrlRichEdit_GetFont. The selection remains invisible even if _GUICtrlRichEdit_SetSel is used afterwards. The script below will demonstrate this.

Run the script and click the button to get started. A series of message boxes will pause the script at each step for verification.

FYI, this causes another issue that will be reported in in bugtracker "_GUICtrlRichEdit_GetFont does not return an empty string for mixed fonts".

#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $hRichEdit, $hGui, $iMsg, $btnNext, $aFontAtts
$hGui = GUICreate("_GUICtrlRichEdit_GetFont", 300, 150, (@DesktopWidth - 300) / 2, 100)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "Selection NOT visible after _GUICtrlRichEdit_GetFont", 10, 10, 300, 90, BitOR($ES_MULTILINE, $ES_NOHIDESEL))
$btnNext = GUICtrlCreateButton(" Click Me To Start ", 110, 110)
GUISetState()
While True
	$iMsg = GUIGetMsg()
	Select
		Case $iMsg = $GUI_EVENT_CLOSE
			_GUICtrlRichEdit_Destroy($hRichEdit)
			Exit
		Case $iMsg = $btnNext
			GUICtrlSetState($btnNext, $GUI_DISABLE)
			_GUICtrlRichEdit_SetSel($hRichEdit, 0, 9) ; <<<< Selection is visible.
			MsgBox(4096, "1", "The word 'Selection' should be visually selected!")
			$aFontAtts = _GUICtrlRichEdit_GetFont($hRichEdit) ; <<<< Causes selection to go invisible.
			MsgBox(4096, "2", _
					"The UFD _GUICtrlRichEdit_GetFont function was called." & @LF & _
					"Is the word 'Selection' still visually selected?" & @LF & _
					"It should be, but it's not." & @LF & _
					@LF & _
					"It's actually selected, although not visually." & @LF & _
					@LF & _
					"Click OK to do _GUICtrlRichEdit_SetSel($hRichEdit, 0, 9).")
			_GUICtrlRichEdit_SetSel($hRichEdit, 0, 9) ; <<<< Setting Seletion again does not make selecion visible.
			; _GUICtrlRichEdit_SetSel($hRichEdit, 0, 9, False) ; <<<< Setting Seletion again does not make selecion visible.
			MsgBox(4096, "3", _
					"Is the word 'Selection' selected?" & @LF & _
					"_GUICtrlRichEdit_SetSel($hRichEdit, 0, 9) was called" & @LF & _
					"but the selection is still invisible." & @LF & _
					@LF & _
					"Even if _GUICtrlRichEdit_SetSel($hRichEdit, 0, 9, False)" & @LF & _
					"is called, the selection is still invisible." & @LF & _
					@LF & _
					"Click OK and it's back to visually selected (I don't know why).")
	EndSelect
WEnd
Exit

Attachments (0)

Change History (3)

comment:1 by water, 12 years ago

Component: AutoItStandard UDFs

comment:2 by J-Paul Mesnage, 12 years ago

Not sure what has to be done to force repainting of the control
Perhaps a bug in Windows API for richEdit.

comment:3 by J-Paul Mesnage, 12 years ago

Resolution: Fixed
Status: newclosed

I found the reason the code has been as this since the beginning
Solved with the same fix as #2496

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


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