1 | ; 'Help' layout |
---|
2 | Global $gui_width = 700 |
---|
3 | Global $gui_height = 500 |
---|
4 | Global $gui_topmargin = 5 |
---|
5 | Global $gui_sidemargin = 10 |
---|
6 | Global $gui_bottommargin = 55 |
---|
7 | Global $gui_okbuttonwidth = 100 |
---|
8 | Global $gui_okbuttonheight = 30 |
---|
9 | Global $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> |
---|
18 | OnAutoItExitRegister("CleanExit") |
---|
19 | |
---|
20 | Global $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) |
---|
32 | GUISetBkColor($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 | |
---|
39 | GUICtrlSetState($gui_textbox, $GUI_FOCUS) |
---|
40 | Send("^{HOME}") |
---|
41 | ; version/build label |
---|
42 | GUICtrlCreateLabel("Build: 1234.5", $gui_sidemargin + 8, $gui_height - 20, ($gui_width - $gui_okbuttonwidth)/2 - 60) |
---|
43 | GUICtrlSetColor(-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 |
---|
49 | GUISetState(@SW_SHOW, $gui_win) |
---|
50 | While 1 |
---|
51 | $msg = GUIGetMsg() |
---|
52 | Select |
---|
53 | Case $msg = $gui_okbutton Or $msg = $GUI_EVENT_CLOSE |
---|
54 | ExitLoop |
---|
55 | EndSelect |
---|
56 | Sleep(10) |
---|
57 | WEnd |
---|
58 | |
---|
59 | ; close and leave help |
---|
60 | GUIDelete() |
---|
61 | |
---|
62 | |
---|
63 | |
---|
64 | Exit |
---|
65 | |
---|
66 | |
---|
67 | Func 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 |
---|
74 | EndFunc |
---|