MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / CreateTabDialog

Method CreateTabDialog

source/script_gui.cpp:10359–10398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10357
10358
10359ResultType GuiType::CreateTabDialog(GuiControlType &aTabControl, GuiControlOptionsType &aOpt)
10360// Creates a dialog to host controls for a tab control.
10361{
10362 HWND tab_dialog;
10363 struct MYDLG : DLGTEMPLATE
10364 {
10365 WORD wNoMenu;
10366 WORD wStdClass;
10367 WORD wNoTitle;
10368 };
10369 MYDLG dlg;
10370 ZeroMemory(&dlg, sizeof(dlg));
10371 dlg.style = WS_VISIBLE | WS_CHILD | DS_CONTROL; // DS_CONTROL enables proper tab navigation and possibly other things.
10372 //dlg.dwExtendedStyle = WS_EX_CONTROLPARENT; // Redundant; DS_CONTROL causes this to be applied.
10373 // Create the dialog.
10374 tab_dialog = CreateDialogIndirect(g_hInstance, &dlg, mHwnd, TabDialogProc);
10375 if (!tab_dialog)
10376 return FAIL;
10377 if (!SetProp(aTabControl.hwnd, _T("ahk_dlg"), tab_dialog))
10378 {
10379 DestroyWindow(tab_dialog);
10380 return FAIL;
10381 }
10382 LONG attrib = aTabControl.tab_index;
10383 if (aOpt.use_theme)
10384 {
10385 // Apply a tab control background to the tab dialog. This also affects
10386 // the backgrounds of some controls, such as Radio and Groupbox controls.
10387 EnableThemeDialogTexture(tab_dialog, 6); // ETDT_ENABLETAB = 6
10388 attrib |= TABDIALOG_ATTRIB_THEMED;
10389 }
10390 SetWindowLongPtr(tab_dialog, GWLP_USERDATA, attrib);
10391 if (!((mExStyle = GetWindowLong(mHwnd, GWL_EXSTYLE)) & WS_EX_CONTROLPARENT))
10392 // WS_EX_CONTROLPARENT must be applied to the parent window as well as the
10393 // tab dialog to allow tab navigation to work correctly. With it applied
10394 // only to the tab dialog, tabbing out of a multi-line edit control won't
10395 // work if it is the last control on a tab.
10396 SetWindowLong(mHwnd, GWL_EXSTYLE, mExStyle |= WS_EX_CONTROLPARENT);
10397 return OK;
10398}
10399
10400
10401

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected