| 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 = FileRead(@Scriptdir & "\Help-en.rtf") |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | ; create GUI styles |
|---|
| 27 | $winstyle = BitOR($WS_CAPTION, $WS_SIZEBOX, $WS_MAXIMIZEBOX) |
|---|
| 28 | $ctrlstyle = BitOR($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 | ; crerate and fill "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 | GUICtrlSetState($gui_textbox, $GUI_FOCUS) |
|---|
| 36 | Send("^{HOME}") |
|---|
| 37 | ; version/build label |
|---|
| 38 | GUICtrlCreateLabel("Build: 1234.5", $gui_sidemargin + 8, $gui_height - 20, ($gui_width - $gui_okbuttonwidth)/2 - 60) |
|---|
| 39 | GUICtrlSetColor(-1, 0xff0000) |
|---|
| 40 | ; "ok" button |
|---|
| 41 | $gui_okbutton = GUICtrlCreateButton("OK", ($gui_width - $gui_okbuttonwidth)/2, $gui_height - ($gui_topmargin + $gui_bottommargin)/2 - $gui_okbuttonheight/2, $gui_okbuttonwidth, $gui_okbuttonheight) |
|---|
| 42 | |
|---|
| 43 | ; display it and loop while checking GUI signals |
|---|
| 44 | ; Written this way to allow other buttons in future |
|---|
| 45 | GUISetState(@SW_SHOW, $gui_win) |
|---|
| 46 | While 1 |
|---|
| 47 | $msg = GUIGetMsg() |
|---|
| 48 | Select |
|---|
| 49 | Case $msg = $gui_okbutton Or $msg = $GUI_EVENT_CLOSE Or $msg = -3 |
|---|
| 50 | ExitLoop |
|---|
| 51 | Case $msg = $GUI_EVENT_RESIZED Or $msg = $GUI_EVENT_MAXIMIZE Or $msg = $GUI_EVENT_RESTORE |
|---|
| 52 | $a = WinGetClientSize($gui_win) |
|---|
| 53 | ControlMove($gui_win, "", $gui_textbox, 10, 10, $a[0] - 20, $a[1] - 20) |
|---|
| 54 | ControlMove($gui_win, "", $gui_textbox, $gui_sidemargin, $gui_topmargin, $a[0] - 2 * $gui_sidemargin, $a[1] - $gui_topmargin - $gui_bottommargin) |
|---|
| 55 | EndSelect |
|---|
| 56 | |
|---|
| 57 | WEnd |
|---|
| 58 | |
|---|
| 59 | ; close and leave help |
|---|
| 60 | _GUICtrlRichEdit_Destroy($gui_textbox) |
|---|
| 61 | GUIDelete() |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | Exit |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | Func CleanExit() |
|---|
| 69 | ; Re-enable input first whatever the reason |
|---|
| 70 | BlockInput(0) |
|---|
| 71 | ; Destroy any rich text GUI used for HELP/INFO, if it exists - this is important (Help:_GUICtrlRichEdit_Destroy) |
|---|
| 72 | If WinExists($gui_win) Then _GUICtrlRichEdit_Destroy($gui_textbox) |
|---|
| 73 | ; And exit |
|---|
| 74 | Exit |
|---|
| 75 | EndFunc |
|---|