140 likes | 174 Views
Dialogs. Types:. Modal System modal Non modal (modeless). MessageBox. Four parameters: Parent window handle Message to show Title Flags. Modality. MB_APPLMODAL (default) MB_SYSTEMMODAL MB_TASKMODAL. Buttons. MB_ABORTRETRYIGNORE MB_CANCELTRYCONTINUE MB_OK MB_OKCANCEL
E N D
Types: • Modal • System modal • Non modal (modeless)
MessageBox Four parameters: • Parent window handle • Message to show • Title • Flags
Modality • MB_APPLMODAL (default) • MB_SYSTEMMODAL • MB_TASKMODAL
Buttons • MB_ABORTRETRYIGNORE • MB_CANCELTRYCONTINUE • MB_OK • MB_OKCANCEL • MB_RETRYCANCEL • MB_YESNO • MB_YESNOCANCEL • MB_HELP
Icons • MB_ICONEXCLAMATION • MB_ICONWARNING • MB_ICONINFORMATION • MB_ICONASTERISK • MB_ICONQUESTION (not recommended) • MB_ICONSTOP • MB_ICONERROR • MB_ICONHAND
Dialog window procedure Differences with window:
Modal dialog window • After dialog window procedure is defined, dialog window can be created with functions DialogBox or DialogBoxParam. • Dialog window has two handles: dialog window itself and parent window’s. • DialogBoxParam creates a modal dialog box from a dialog box template resource. It has 5th argument, which is sent to dialog procedure as LPARAM parameter of the WM_INITDIALOG MESSAGE.
Indirect dialog window • Functions DialogBoxIndirect or DialogBoxIndirectParam creates a modal box from a dialog box template • DLGTEMPLATE(EX) structure • DLGITEMTEMPLATE(EX) structure let define individual dialog window
With class • WNDCLASS structure can be used to define dialog: • wnd.cbWndWxtra = DLGWINDOWEXTRA; • Register as simple window
Message loop • IsDialogMessage is function used to modify message loop for modeless (not necessarily) dialog boxes