Modify

Opened 11 years ago

Closed 11 years ago

#2781 closed Bug (No Bug)

_GUICtrlRichEdit_IsTextSelected - always False never True

Reported by: mLipok Owned by:
Milestone: Component: Standard UDFs
Version: 3.3.12.0 Severity: None
Keywords: Cc:

Description

REPRO:

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

Example()

Func Example()
	Local $iMsg
	Local $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, 4) & ")", 320, 250, -1, -1)
	Local $hRichEdit1 = _GUICtrlRichEdit_Create($hGui, "This is a first test.", 10, 10, 300, 220, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
	_GUICtrlRichEdit_AppendText($hRichEdit1, @CRLF & "This is more text" & @CRLF)

	GUISetState(@SW_SHOW)

	_GUICtrlRichEdit_SelectionTest($hRichEdit1)

	While True
		$iMsg = GUIGetMsg()
		Select
			Case $iMsg = $GUI_EVENT_CLOSE
				_GUICtrlRichEdit_Destroy($hRichEdit1) ; needed unless script crashes
				; GUIDelete() 	; is OK too
				Exit
		EndSelect
	WEnd
EndFunc   ;==>Example

Func _GUICtrlRichEdit_SelectionTest(ByRef $hSourceRichEdit)
	Local $bIsSelected = _GUICtrlRichEdit_IsTextSelected($hSourceRichEdit)
	Local $kError = @error
	MsgBox($MB_SYSTEMMODAL, 'before Selection', 'Try to select manualy, and after selection, press OK button')
	Local $vRichEdit_Stream = _GUICtrlRichEdit_StreamToVar($hSourceRichEdit)
	MsgBox($MB_SYSTEMMODAL, 'Selection Test','$bIsSelected = ' & $bIsSelected & ' @error = ' & $kError& @CRLF & @CRLF & $vRichEdit_Stream)
EndFunc   ;==>_GUICtrlRichEdit_SelectionTest

Change History (2)

Changed 11 years ago by mLipok

comment:1 Changed 11 years ago by Melba23

  • Resolution set to No Bug
  • Status changed from new to closed

You are not testing after selecting the text - when you do you will see that it works as advertised:

Func _GUICtrlRichEdit_SelectionTest(ByRef $hSourceRichEdit)

	Local $bIsSelected = _GUICtrlRichEdit_IsTextSelected($hSourceRichEdit)
	ConsoleWrite("Before selection: " & $bIsSelected & @CRLF)

	MsgBox($MB_SYSTEMMODAL, 'Selection', 'Select some text and then press OK button')

	Local $bIsSelected = _GUICtrlRichEdit_IsTextSelected($hSourceRichEdit)
	ConsoleWrite("After selection: " & $bIsSelected & @CRLF)

EndFunc   ;==>_GUICtrlRichEdit_SelectionTest

M23

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

Author


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

 
Note: See TracTickets for help on using tickets.