Modify

Opened 6 years ago

Closed 6 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 Changed 6 years ago by water

  • Component changed from AutoIt to Standard UDFs

comment:2 Changed 6 years ago by Jpm

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

comment:3 Changed 6 years ago by Jpm

  • Resolution set to Fixed
  • Status changed from new to closed

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

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 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.