Ticket #1987: tmp2.au3

File tmp2.au3, 2.6 KB (added by Stilez, 13 years ago)

Test file for rich test dialog showing the crash

Line 
1; 'Help' layout
2Global $gui_width = 700
3Global $gui_height = 500
4Global $gui_topmargin = 5
5Global $gui_sidemargin = 10
6Global $gui_bottommargin = 55
7Global $gui_okbuttonwidth = 100
8Global $gui_okbuttonheight = 30
9Global $gui_winbkcolor = 0xFFFFD8
10
11#include <GUIConstantsEx.au3>
12#include <EditConstants.au3>
13#include <WindowsConstants.au3>
14#include <StaticConstants.au3>
15#Include <Array.au3>
16#Include <String.au3>
17#Include <GuiRichEdit.au3>
18OnAutoItExitRegister("CleanExit")
19
20Global $gui_winhandle = -1
21
22$text =_StringRepeat("ABCDEFG abcdefg ",500)
23
24$text = "{\rtf1\ansi\deff0 {\colortbl;\red0\green0\blue0;\red255\green0\blue0;}This line is the default color\line\cf2\tab This line is red and has a tab before it\line\cf1\page This line is the default color and the first line on page 2}"
25
26; create GUI styles
27$winstyle = $WS_CAPTION + $WS_SIZEBOX + $WS_MAXIMIZEBOX
28$ctrlstyle = $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_MULTILINE + $ES_READONLY
29
30; create GUI window
31$gui_win = GUICreate("Classic Quick Launch:  Help", $gui_width, $gui_height, -1, -1, $winstyle)
32GUISetBkColor($gui_winbkcolor)
33; "help" textbox, focus it, go to top (ctrl-home)
34$gui_textbox = _GUICtrlRichEdit_Create($gui_win, $text, $gui_sidemargin, $gui_topmargin, $gui_width - 2 * $gui_sidemargin, $gui_height - $gui_topmargin - $gui_bottommargin, $ctrlstyle)
35
36; --------------- Adding the line below crashes AutoIt. Commenting it out doesn't ----------
37_GUICtrlRichEdit_StreamFromFile($gui_textbox, "C:\Users\Temp user\Desktop\QL RC 1.02\Help-en.rtf")
38
39GUICtrlSetState($gui_textbox, $GUI_FOCUS)
40Send("^{HOME}")
41; version/build label
42GUICtrlCreateLabel("Build:   1234.5", $gui_sidemargin + 8, $gui_height - 20, ($gui_width - $gui_okbuttonwidth)/2 - 60)
43GUICtrlSetColor(-1, 0xff0000)
44; "ok" button
45$gui_okbutton = GUICtrlCreateButton("OK", ($gui_width - $gui_okbuttonwidth)/2, $gui_height - ($gui_topmargin + $gui_bottommargin)/2 - $gui_okbuttonheight/2, $gui_okbuttonwidth, $gui_okbuttonheight)
46
47; display it and loop while checking GUI signals
48; Written this way to allow other buttons in future
49GUISetState(@SW_SHOW, $gui_win)
50While 1
51        $msg = GUIGetMsg()
52        Select
53                Case $msg = $gui_okbutton Or $msg = $GUI_EVENT_CLOSE
54                        ExitLoop
55        EndSelect
56        Sleep(10)
57WEnd
58
59; close and leave help
60GUIDelete()
61
62
63
64Exit
65
66
67Func CleanExit()
68        ; Re-enable input first whatever the reason
69        BlockInput(0)
70        ; Destroy any rich text GUI used for HELP/INFO, if it exists - this is important (Help:_GUICtrlRichEdit_Destroy)
71        If WinExists($gui_winhandle) Then _GUICtrlRichEdit_Destroy($gui_winhandle)
72        ; And exit
73        Exit
74EndFunc