Ticket #2781: _GUICtrlRichEdit_SelectionRepro.au3

File _GUICtrlRichEdit_SelectionRepro.au3, 1.3 KB (added by mLipok, on Jul 2, 2014 at 10:49:47 AM)
Line 
1#include <GUIConstantsEx.au3>
2#include <GuiRichEdit.au3>
3#include <WindowsConstants.au3>
4#include <MsgBoxConstants.au3>
5
6Example()
7
8Func Example()
9 Local $iMsg
10 Local $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, 4) & ")", 320, 250, -1, -1)
11 Local $hRichEdit1 = _GUICtrlRichEdit_Create($hGui, "This is a first test.", 10, 10, 300, 220, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
12 _GUICtrlRichEdit_AppendText($hRichEdit1, @CRLF & "This is more text" & @CRLF)
13
14 GUISetState(@SW_SHOW)
15
16 _GUICtrlRichEdit_SelectionTest($hRichEdit1)
17
18 While True
19 $iMsg = GUIGetMsg()
20 Select
21 Case $iMsg = $GUI_EVENT_CLOSE
22 _GUICtrlRichEdit_Destroy($hRichEdit1) ; needed unless script crashes
23 ; GUIDelete() ; is OK too
24 Exit
25 EndSelect
26 WEnd
27EndFunc ;==>Example
28
29Func _GUICtrlRichEdit_SelectionTest(ByRef $hSourceRichEdit)
30 Local $bIsSelected = _GUICtrlRichEdit_IsTextSelected($hSourceRichEdit)
31 Local $kError = @error
32 MsgBox($MB_SYSTEMMODAL, 'before Selection', 'Try to select manualy, and after selection, press OK button')
33 Local $vRichEdit_Stream = _GUICtrlRichEdit_StreamToVar($hSourceRichEdit)
34 MsgBox($MB_SYSTEMMODAL, 'Selection Test','$bIsSelected = ' & $bIsSelected & ' @error = ' & $kError& @CRLF & @CRLF & $vRichEdit_Stream)
35EndFunc ;==>_GUICtrlRichEdit_SelectionTest