1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3 4<head> 5<title>Windows Interface Reference: Dialog structure</title> 6</head> 7 8<body> 9 10<h1>Dialog</h1> 11 12<p>The Dialog structure contains functions and structures to create and operate on 13dialogue boxes.</p> 14 15<pre>structure Dialog: 16sig 17 type HWND and HINSTANCE 18 datatype 19 DLGCLASSES = 20 DLG_CLASS of string * Window.Style.flags 21 | DLG_BUTTON of Button.Style.flags 22 | DLG_COMBOBOX of Combobox.Style.flags 23 | DLG_EDIT of Edit.Style.flags 24 | DLG_LISTBOX of Listbox.Style.flags 25 | DLG_SCROLLBAR of Scrollbar.Style.flags 26 | DLG_STATIC of Static.Style.flags 27 28 datatype DLGTITLE = DLG_TITLERESOURCE of int | DLG_TITLESTRING of string 29 30 structure Style: 31 sig 32 include BIT_FLAGS 33 val WS_OVERLAPPED: flags and WS_POPUP: flags and WS_CHILD: flags and WS_MINIMIZE: flags 34 and WS_VISIBLE: flags and WS_DISABLED:flags and WS_CLIPSIBLINGS:flags 35 and WS_CLIPCHILDREN:flags and WS_MAXIMIZE:flags and WS_CAPTION:flags 36 and WS_BORDER:flags and WS_DLGFRAME:flags and WS_VSCROLL:flags and WS_HSCROLL:flags 37 and WS_SYSMENU:flags and WS_THICKFRAME:flags and WS_GROUP:flags and WS_TABSTOP:flags 38 and WS_MINIMIZEBOX:flags and WS_MAXIMIZEBOX:flags and WS_TILED:flags and WS_ICONIC:flags 39 and WS_SIZEBOX:flags and WS_OVERLAPPEDWINDOW:flags and WS_TILEDWINDOW:flags 40 and WS_POPUPWINDOW:flags and WS_CHILDWINDOW:flags 41 and DS_3DLOOK: flags and DS_ABSALIGN: flags and DS_CENTER: flags and DS_CENTERMOUSE: flags 42 and DS_CONTEXTHELP: flags and DS_CONTROL: flags and DS_FIXEDSYS: flags 43 and DS_LOCALEDIT: flags and DS_MODALFRAME: flags and DS_NOFAILCREATE: flags 44 and DS_NOIDLEMSG: flags and DS_SETFONT: flags and DS_SETFOREGROUND: flags 45 and DS_SYSMODAL: flags 46 end 47 48 type DLGITEMTEMPLATE = 49 { extendedStyle: int, 50 x: int, 51 y: int, 52 cx : int, 53 cy: int, 54 id: int, 55 class: DLGCLASSES, 56 title: DLGTITLE, 57 creationData: Word8Vector.vector option 58 } 59 60 type DLGTEMPLATE = 61 { style: Style.flags, 62 extendedStyle: int, 63 x : int, 64 y: int, 65 cx: int, 66 cy: int, 67 menu: Resource.RESID option, 68 class: Resource.RESID option, 69 title: string, 70 font: (int * string) option, 71 items: DLGITEMTEMPLATE list 72 } 73 74 75 val <a 76href="#DialogBox">DialogBox</a> : 77 HINSTANCE * Resource.RESID * HWND * 78 (HWND * Message.Message * 'a -> Message.LRESULT * 'a) * 'a -> int 79 val <a 80href="#DialogBoxIndirect">DialogBoxIndirect</a>: HINSTANCE * DLGTEMPLATE * HWND * 81 (HWND * Message.Message * 'a -> Message.LRESULT * 'a) * 'a -> int 82 val <a 83href="#CreateDialog">CreateDialog</a> : HINSTANCE * Resource.RESID * HWND * 84 (HWND * Message.Message * 'a -> Message.LRESULT * 'a) * 'a -> HWND 85 val <a 86href="#CreateDialogIndirect">CreateDialogIndirect</a>: HINSTANCE * DLGTEMPLATE * HWND * 87 (HWND * Message.Message * 'a -> Message.LRESULT * 'a) * 'a -> HWND 88 89 val GetDialogBaseUnits : unit -> {horizontal: int, vertical: int} 90 91 val GetDlgCtrlID: HWND -> int 92 and <a 93name="GetDlgItem">GetDlgItem</a>: HWND * int -> HWND 94 and GetDlgItemText: HWND * int -> string 95 and IsDialogMessage: HWND * Message.MSG -> bool 96 and EndDialog: HWND * int -> unit 97 98 val <a 99href="#compileTemplate">compileTemplate</a> : DLGTEMPLATE -> Word8Vector.vector 100 val <a 101href="#decompileTemplate">decompileTemplate</a> : Word8Vector.vector -> DLGTEMPLATE</pre> 102 103<p><tt><a name="DialogBox">DialogBox</a>(hInst, resId, parent, dlgProc, dlgInit)<br> 104<a name="DialogBoxIndirect">DialogBoxIndirect</a>(hInst, template, parent, dlgProc, 105dlgInit)<br> 106<a name="CreateDialog">CreateDialog</a>(hInst, resId, parent, dlgProc, dlgInit)<br> 107<a name="CreateDialogIndirect">CreateDialogIndirect</a>(hInst, template, parent, dlgProc, 108dlgInit)</tt><br> 109These four functions all create dialogues. They all take a dialogue procedure and an 110initial state for the dialogue. A dialogue procedure has the form<br> 111dlgProc(dlg, msg, state) and returns a pair consisting of the result of processing the 112message (LRESINT 0 if the message is not processed) and a new state. Each time the 113dialogue procedure is called it is passed the state returned by the previous call.<br> 114DialogBox and DialogBoxIndirect create modal dialogues and do not return until the 115dialogue procedure calls EndDialog, typically as a result of the user pressing an OK or 116Cancel button. CreateDialog and CreateDialogIndirect create modeless dialogues. 117 The ML implementation automatically ensures that IsDialogMessage is called for 118modeless dialogues if <a href="Message.html#RunApplication">RunApplication</a> is used.</p> 119 120<p><tt><a name="compileTemplate">compileTemplate</a>(template)</tt><br> 121<strong>ML Extension:</strong> Compiles an ML dialogue template into the format used 122by C. This can be stored to resource file for later use.</p> 123 124<p><tt><a name="decompileTemplate">decompileTemplate</a>(vector)</tt><br> 125<strong>ML Extension:</strong> Takes a C format dialogue template structure in memory and 126returns an ML template. It can be used where a dialogue template has been loaded 127from a resource file using <a href="Resource.html#LoadResource">LoadResource</a>.</p> 128 129<p> </p> 130</body> 131</html> 132