Esempio n. 1
0
BOOL CDialog::OnInitDialog()
{
	// execute dialog RT_DLGINIT resource
	BOOL bDlgInit;
	if (m_lpDialogInit != NULL)
		bDlgInit = ExecuteDlgInit(m_lpDialogInit);
	else
		bDlgInit = ExecuteDlgInit(m_lpszTemplateName);

	if (!bDlgInit)
	{
		TRACE0("Warning: ExecuteDlgInit failed during dialog init.\n");
		EndDialog(-1);
		return FALSE;
	}

	// transfer data into the dialog from member variables
	if (!UpdateData(FALSE))
	{
		TRACE0("Warning: UpdateData failed during dialog init.\n");
		EndDialog(-1);
		return FALSE;
	}

	// enable/disable help button automatically
	CWnd* pHelpButton = GetDlgItem(ID_HELP);
	if (pHelpButton != NULL)
		pHelpButton->ShowWindow(AfxHelpEnabled() ? SW_SHOW : SW_HIDE);

	return TRUE;    // set focus to first one
}
Esempio n. 2
0
BOOL FDialog::ExecuteDlgInit()
{
	// find resource handle
	LPVOID lpResource = NULL;
	HGLOBAL hResource = NULL;
	HRSRC hDlgInit = ::FindResource(g_hInstance, MAKEINTRESOURCE(m_nDialogId), MAKEINTRESOURCE(240));
	if (hDlgInit != NULL)
	{
		// load it
		hResource = LoadResource(g_hInstance, hDlgInit);
		if (hResource == NULL)
			return FALSE;
		// lock it
		lpResource = LockResource(hResource);
		assert(lpResource != NULL);
	}

	// execute it
	BOOL bResult = ExecuteDlgInit(lpResource);

	// cleanup
	if (lpResource != NULL && hResource != NULL)
	{
		UnlockResource(hResource);
		FreeResource(hResource);
	}
	return bResult;
}
Esempio n. 3
0
LRESULT PageSettingsTabsColors::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	ExecuteDlgInit(IDD);

	if (CTheme().IsThemingSupported()) ::EnableThemeDialogTexture(m_hWnd, ETDT_USETABTEXTURE);

	return TRUE;
}
LRESULT PageSettingsTabs1::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	ExecuteDlgInit(IDD);

	if (CTheme().IsThemingSupported()) ::EnableThemeDialogTexture(m_hWnd, ETDT_USETABTEXTURE);

	m_comboCursor.Attach(GetDlgItem(IDC_COMBO_CURSOR));
	m_staticCursorColor.Attach(GetDlgItem(IDC_CURSOR_COLOR));

	DoDataExchange(DDX_LOAD);
	return TRUE;
}
Esempio n. 5
0
BOOL FDialog::SetTemplate(const DLGTEMPLATE* pTemplate, UINT cb)
{
	m_dwTemplateSize = cb;
	if ((m_hTemplate = GlobalAlloc(GPTR, m_dwTemplateSize + LF_FACESIZE * 2)) == NULL)
		return FALSE;
	DLGTEMPLATE* pNew = (DLGTEMPLATE*)GlobalLock(m_hTemplate);
	memcpy((BYTE*)pNew, pTemplate, (size_t)m_dwTemplateSize);
	m_bSystemFont = (::HasFont(pNew) == 0);
	ExecuteDlgInit((void*)pTemplate);
	GlobalUnlock(m_hTemplate);
	return TRUE;
}
Esempio n. 6
0
BOOL CCustomDialog::OnInitDialog(void)
{
	// try to execute dialog RT_DLGINIT resource
	BOOL bDlgInit = FALSE;
	if (m_lpDialogInit != NULL)
	{
		bDlgInit = ExecuteDlgInit(m_lpDialogInit);
	}
	else
	{
		bDlgInit = ExecuteDlgInit(m_lpszDlgInitName);
	}

	if (!bDlgInit)
	{
		TRACE(traceAppMsg, 0, "Warning: ExecuteDlgInit failed during dialog init.\n");
		EndDialog(-1);
		return (FALSE);
	}

	// transfer data into the dialog from member variables
	if (!UpdateData(FALSE))
	{
		TRACE(traceAppMsg, 0, "Warning: UpdateData failed during dialog init.\n");
		EndDialog(-1);
		return (FALSE);
	}

	// enable/disable help button automatically
	CWnd* pHelpButton = GetDlgItem(ID_HELP);
	if (pHelpButton != NULL)
	{
		pHelpButton->ShowWindow(AfxHelpEnabled() ? SW_SHOW : SW_HIDE);
	}

	// set focus to first one
	return (TRUE);
}
Esempio n. 7
0
LRESULT PageSettingsTabs1::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	ExecuteDlgInit(IDD);

	if (CTheme().IsThemingSupported()) ::EnableThemeDialogTexture(m_hWnd, ETDT_USETABTEXTURE);

	m_tabIconEdit.SubclassWindow(GetDlgItem(IDC_TAB_ICON));
	m_tabShellEdit.SubclassWindow(GetDlgItem(IDC_TAB_SHELL));
	m_tabInitialDirEdit.SubclassWindow(GetDlgItem(IDC_TAB_INIT_DIR));

	m_comboPriority.Attach(GetDlgItem(IDC_COMBO_BASE_PRIORITY));
	DoDataExchange(DDX_LOAD);
	return TRUE;
}
Esempio n. 8
0
LRESULT DlgSettingsMouse::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	ExecuteDlgInit(IDD);

	m_mouseSettings.Load(m_pOptionsRoot);

	m_listCtrl.Attach(GetDlgItem(IDC_LIST_MOUSE_COMMANDS));
	m_editCommand.Attach(GetDlgItem(IDC_EDIT_COMMAND));
	m_comboButtons.Attach(GetDlgItem(IDC_COMBO_BUTTONS));

	m_btnCtrl.Attach(GetDlgItem(IDC_CHECK_CTRL));
	m_btnShift.Attach(GetDlgItem(IDC_CHECK_SHIFT));
	m_btnAlt.Attach(GetDlgItem(IDC_CHECK_ALT));

	m_listCtrl.SetExtendedListViewStyle(m_listCtrl.GetExtendedListViewStyle()|LVS_EX_FULLROWSELECT);

	m_listCtrl.InsertColumn(0, L"Command", LVCFMT_LEFT, 50, 0);
	m_listCtrl.InsertColumn(1, L"Mouse action", LVCFMT_LEFT, 50, 0);

	m_listCtrl.SetColumnWidth(0, 170);
	m_listCtrl.SetColumnWidth(1, 218);

	MouseSettings::CommandsSequence::iterator it = m_mouseSettings.commands.begin();
	for (; it != m_mouseSettings.commands.end(); ++it)
	{
		int nItem = m_listCtrl.InsertItem(m_listCtrl.GetItemCount(), (*it)->strDescription.c_str());
		m_listCtrl.SetItemData(nItem, reinterpret_cast<DWORD_PTR>(it->get()));

		CString strAction;

		m_comboButtons.GetLBText(static_cast<int>((*it)->action.button), strAction);
		
		if ((*it)->action.modifiers & MouseSettings::mkCtrl) strAction += L" + Ctrl";
		if ((*it)->action.modifiers & MouseSettings::mkShift) strAction += L" + Shift";
		if ((*it)->action.modifiers & MouseSettings::mkAlt) strAction += L" + Alt";
		m_listCtrl.SetItemText(nItem, 1, strAction);
	}

	m_comboButtons.SetCurSel(0);
	m_listCtrl.SelectItem(0);

	DoDataExchange(DDX_LOAD);
	return TRUE;
}
Esempio n. 9
0
// virtual override of CWnd::Create
BOOL CFormView::Create(LPCTSTR /*lpszClassName*/, LPCTSTR /*lpszWindowName*/,
                       DWORD dwRequestedStyle, const RECT& rect, CWnd* pParentWnd, UINT nID,
                       CCreateContext* pContext)
{
    ASSERT(pParentWnd != NULL);
    ASSERT(m_lpszTemplateName != NULL);

    m_pCreateContext = pContext;    // save state for later OnCreate

#ifdef _DEBUG
    // dialog template must exist and be invisible with WS_CHILD set
    if (!_AfxCheckDialogTemplate(m_lpszTemplateName, TRUE))
    {
        ASSERT(FALSE);          // invalid dialog template name
        PostNcDestroy();        // cleanup if Create fails too soon
        return FALSE;
    }
#endif //_DEBUG

    // initialize common controls
    VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTLS_REG));
    AfxDeferRegisterClass(AFX_WNDCOMMCTLSNEW_REG);

    // call PreCreateWindow to get prefered extended style
    CREATESTRUCT cs;
    memset(&cs, 0, sizeof(CREATESTRUCT));
    if (dwRequestedStyle == 0)
        dwRequestedStyle = AFX_WS_DEFAULT_VIEW;
    cs.style = dwRequestedStyle;
    if (!PreCreateWindow(cs))
        return FALSE;

    // create a modeless dialog
    if (!CreateDlg(m_lpszTemplateName, pParentWnd))
        return FALSE;

    m_pCreateContext = NULL;

    // we use the style from the template - but make sure that
    //  the WS_BORDER bit is correct
    // the WS_BORDER bit will be whatever is in dwRequestedStyle
    ModifyStyle(WS_BORDER|WS_CAPTION, cs.style & (WS_BORDER|WS_CAPTION));
    ModifyStyleEx(WS_EX_CLIENTEDGE, cs.dwExStyle & WS_EX_CLIENTEDGE);

    SetDlgCtrlID(nID);

    CRect rectTemplate;
    GetWindowRect(rectTemplate);
    SetScrollSizes(MM_TEXT, rectTemplate.Size());

    // initialize controls etc
    if (!ExecuteDlgInit(m_lpszTemplateName))
        return FALSE;

    // force the size requested
    SetWindowPos(NULL, rect.left, rect.top,
                 rect.right - rect.left, rect.bottom - rect.top,
                 SWP_NOZORDER|SWP_NOACTIVATE);

    // make visible if requested
    if (dwRequestedStyle & WS_VISIBLE)
        ShowWindow(SW_NORMAL);

    return TRUE;
}
Esempio n. 10
0
//****************************************************************************************
BOOL CBCGDialogBar::Create(LPCTSTR lpszWindowName, CWnd* pParentWnd, BOOL bHasGripper, 
						   LPCTSTR lpszTemplateName, UINT nStyle, UINT nID)
{
	ASSERT(pParentWnd != NULL);
	ASSERT(lpszTemplateName != NULL);

	//------------------------------------------------------
    // cannot be both fixed and dynamic
    // (CBRS_SIZE_DYNAMIC is used for resizng when floating)
	//------------------------------------------------------
    ASSERT (!((nStyle & CBRS_SIZE_FIXED) &&
              (nStyle & CBRS_SIZE_DYNAMIC)));

	if (bHasGripper)
	{
		m_cyGripper = max (12, globalData.GetTextHeight ());
	}
	else
	{
		m_cyGripper = 0;
	}

	m_bAllowSizing = nStyle & CBRS_SIZE_DYNAMIC ? TRUE : FALSE;

	//------------------------------
	// allow chance to modify styles
	//------------------------------
	m_dwStyle = (nStyle & CBRS_ALL);

	CREATESTRUCT cs;
	memset(&cs, 0, sizeof(cs));
	cs.lpszClass = AFX_WNDCONTROLBAR;
	cs.lpszName = lpszWindowName;
	cs.style = (DWORD)nStyle | WS_CHILD;
	cs.hMenu = (HMENU)(UINT_PTR) nID;
	cs.hInstance = AfxGetInstanceHandle();
	cs.hwndParent = pParentWnd->GetSafeHwnd();

	if (!PreCreateWindow(cs))
	{
		return FALSE;
	}

#ifndef _AFX_NO_OCC_SUPPORT
	m_lpszTemplateName = lpszTemplateName;
#endif

	//----------------------------
	// initialize common controls
	//----------------------------
	VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTLS_REG));
	AfxDeferRegisterClass(AFX_WNDCOMMCTLSNEW_REG);

	//--------------------------
	// create a modeless dialog
	//--------------------------
	if (!CreateDlg (lpszTemplateName, pParentWnd))
	{
		TRACE(_T("Can't create dialog: %s\n"), lpszTemplateName);
		return FALSE;
	}

#ifndef _AFX_NO_OCC_SUPPORT
	m_lpszTemplateName = NULL;
#endif

#pragma warning (disable : 4311)
	SetClassLongPtr (m_hWnd, GCLP_HBRBACKGROUND, (long)::GetSysColorBrush(COLOR_BTNFACE));
#pragma warning (default : 4311)

	//----------------------------------------------
	// dialog template MUST specify that the dialog
	// is an invisible child window
	//----------------------------------------------
	SetDlgCtrlID(nID);

	CRect rect;
	GetWindowRect(&rect);
	m_sizeDefault = rect.Size();    // set fixed size

    m_szHorz = m_sizeDefault; // set the size members
    m_szVert = m_sizeDefault;
    m_szFloat = m_sizeDefault;

	//-----------------------
	// force WS_CLIPSIBLINGS
	//-----------------------
	ModifyStyle(0, WS_CLIPSIBLINGS);

	if (!ExecuteDlgInit(lpszTemplateName))
		return FALSE;

	//--------------------------------------------------------
	// force the size to zero - resizing bar will occur later
	//--------------------------------------------------------
	SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOACTIVATE|SWP_SHOWWINDOW);

	if (lpszWindowName != NULL)
	{
		SetWindowText (lpszWindowName);
	}

	return TRUE;
}
Esempio n. 11
0
LRESULT DlgSettingsAppearance::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	ExecuteDlgInit(IDD);

	m_comboFontSmoothing.Attach(GetDlgItem(IDC_COMBO_SMOOTHING));
	m_comboDocking.Attach(GetDlgItem(IDC_COMBO_DOCKING));
	m_comboZOrder.Attach(GetDlgItem(IDC_COMBO_ZORDER));

	m_windowSettings.Load(m_pOptionsRoot);
	m_fontSettings.Load(m_pOptionsRoot);
	m_positionSettings.Load(m_pOptionsRoot);

	m_strWindowTitle	= m_windowSettings.strTitle.c_str();
	m_nUseTabTitle		= m_windowSettings.bUseTabTitles ? 1 : 0;
	m_nUseConsoleTitle	= m_windowSettings.bUseConsoleTitle ? 1 : 0;
	m_nShowCommand		= m_windowSettings.bShowCommand ? 1 : 0;
	m_nShowCommandTabs	= m_windowSettings.bShowCommandInTabs ? 1 : 0;
	m_nTrimTabTitles	= (m_windowSettings.dwTrimTabTitles > 0) ? 1 : 0;
	m_strWindowIcon		= m_windowSettings.strIcon.c_str();
	m_nUseTabIcon		= m_windowSettings.bUseTabIcon ? 1 : 0;

	m_strFontName	= m_fontSettings.strName.c_str();
	m_nFontBold		= m_fontSettings.bBold ? 1 : 0;
	m_nFontItalic	= m_fontSettings.bItalic ? 1 : 0;

	m_comboFontSmoothing.SetCurSel(static_cast<int>(m_fontSettings.fontSmoothing));

	m_nUseFontColor	= m_fontSettings.bUseColor ? 1 : 0;

	m_nUsePosition	= ((m_positionSettings.nX == -1) && (m_positionSettings.nY == -1)) ? 0 : 1;
	m_nX			= ((m_positionSettings.nX == -1) && (m_positionSettings.nY == -1)) ? 0 : m_positionSettings.nX;
	m_nY			= ((m_positionSettings.nX == -1) && (m_positionSettings.nY == -1)) ? 0 : m_positionSettings.nY;
	m_nSavePosition	= m_positionSettings.bSavePosition ? 1 : 0;

	m_nSnapToEdges	= (m_positionSettings.nSnapDistance == -1) ? 0 : 1;
	if (m_nSnapToEdges == 0) m_positionSettings.nSnapDistance = 0;

	m_comboDocking.SetCurSel(static_cast<int>(m_positionSettings.dockPosition) + 1);
	m_comboZOrder.SetCurSel(static_cast<int>(m_positionSettings.zOrder));

	CUpDownCtrl	spin;
	UDACCEL udAccel;

	spin.Attach(GetDlgItem(IDC_SPIN_TRIM_TAB_TITLES));
	spin.SetRange(1, 100);
	spin.Detach();

	spin.Attach(GetDlgItem(IDC_SPIN_FONT_SIZE));
	spin.SetRange(5, 36);
	spin.Detach();

	spin.Attach(GetDlgItem(IDC_SPIN_X));
	spin.SetRange(-2048, 2048);
	udAccel.nSec = 0;
	udAccel.nInc = 5;
	spin.SetAccel(1, &udAccel);
	spin.Detach();

	spin.Attach(GetDlgItem(IDC_SPIN_Y));
	spin.SetRange(-2048, 2048);
	udAccel.nSec = 0;
	udAccel.nInc = 5;
	spin.SetAccel(1, &udAccel);
	spin.Detach();

	spin.Attach(GetDlgItem(IDC_SPIN_SNAP));
	spin.SetRange(0, 20);
	spin.Detach();

	EnableControls();

	DoDataExchange(DDX_LOAD);
	return TRUE;
}
Esempio n. 12
0
BOOL COXSizeDialogBar::Create(CWnd* pParentWnd, LPCTSTR lpszTemplateName,
							  UINT nStyle, UINT nID)
{
	ASSERT(pParentWnd != NULL);
	ASSERT(lpszTemplateName != NULL);
	ASSERT((nStyle & WS_THICKFRAME)==NULL);
	
// Alas, MFC doesn't export many of the debugg-only functions, but I've added
// the code for this safety net as it helps track down errors faster, and
// only has an overhead in debug code
#ifdef _DEBUG
// dialog template must exist and be invisible with WS_CHILD set
	if (!CheckDialogTemplate(lpszTemplateName, TRUE))
	{
		ASSERT(FALSE);          // invalid dialog template name
		PostNcDestroy();        // cleanup if Create fails too soon
		return FALSE;
	}
#endif //_DEBUG

	// allow chance to modify styles
#if _MFC_VER <= 0x0421
	m_dwStyle = nStyle;
#else
    m_dwStyle = nStyle&CBRS_ALL;
#endif
	CREATESTRUCT cs;
	memset(&cs, 0, sizeof(cs));
	cs.lpszClass = _afxWndControlBar;
	cs.style = (DWORD)nStyle | WS_CHILD;
	cs.hMenu = (HMENU)(UINT_PTR)nID;
	cs.hInstance = AfxGetInstanceHandle();
	cs.hwndParent = pParentWnd->GetSafeHwnd();
	if (!PreCreateWindow(cs))
		return FALSE;
	
	// create a modeless dialog
#ifndef _AFX_NO_OCC_SUPPORT
	m_lpszTemplateName = lpszTemplateName;
#endif

	// initialize common controls
	//VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTLS_REG));

	BOOL bSuccess = CreateDlg(lpszTemplateName, pParentWnd);

#ifndef _AFX_NO_OCC_SUPPORT
	m_lpszTemplateName = NULL;
#endif

	if (!bSuccess)
		return FALSE;
	
	// dialog template MUST specify that the dialog
	//  is an invisible child window
	SetDlgCtrlID(nID);
	CRect rect;
	
	
	// force WS_CLIPSIBLINGS
	// I also remove the titlebar. This means the resource can include a caption, which
	// will be used when the frame is floating.
	ModifyStyle(WS_CAPTION, WS_CLIPSIBLINGS);		
	if (!ExecuteDlgInit(lpszTemplateName))
		return FALSE;
	
	// m_sizeDefault isn't actually used by the COXSizeDialogBar, but since it's public, it
	// seemed sensible to keep it available. Otherwise it might be difficult to get hold
	// of the original size of the dialog (as specified in the resource file). 
	
	//GetWindowRect(&rect);
	GetClientRect(&rect);
	m_sizeDefault = rect.Size();    // set fixed size
	
	// Move to position 0,0
	// NB: size not forced to zero, as this can affect resizing if bar is 
	// immediately docked
	SetWindowPos(NULL, 0, 0, 0, 0, 
		SWP_NOZORDER|SWP_NOACTIVATE|SWP_SHOWWINDOW|SWP_NOSIZE|SWP_FRAMECHANGED);
	
	// set all the sizes to be the default after the positioning done above
	m_VertDockSize 	= m_sizeDefault;
	m_HorzDockSize  = m_sizeDefault;
	m_FloatSize 	= m_sizeDefault;
	
	
	// if auto-sizing, store the rectangles of all the child windows.
	if(m_Style & SZBARF_DLGAUTOSIZE)	
	{
		m_GadgetResizeHandle = CreateGadgetResizeHandle(this);
	}

	return TRUE;
}
Esempio n. 13
0
LRESULT DlgSettingsAppearance::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	ExecuteDlgInit(IDD);

	m_comboDocking.Attach(GetDlgItem(IDC_COMBO_DOCKING));
	m_comboZOrder.Attach(GetDlgItem(IDC_COMBO_ZORDER));

	m_windowSettings.Load(m_pOptionsRoot);
	m_positionSettings.Load(m_pOptionsRoot);

	m_strWindowTitle = m_windowSettings.strTitle.c_str();
	m_strMainTitleFormat = m_windowSettings.strMainTitleFormat.c_str();
	m_strTabTitleFormat  = m_windowSettings.strTabTitleFormat.c_str();
	m_bTrimTabTitles = (m_windowSettings.dwTrimTabTitles > 0);
	m_strWindowIcon  = m_windowSettings.strIcon.c_str();

	m_bUsePosition   = ((m_positionSettings.nX == -1) && (m_positionSettings.nY == -1)) ? false : true;
	m_nX             = m_bUsePosition ? m_positionSettings.nX : 0;
	m_nY             = m_bUsePosition ? m_positionSettings.nY : 0;

	m_bUseSize       = ((m_positionSettings.nW == -1) && (m_positionSettings.nH == -1)) ? false : true;
	m_nW             = m_bUseSize ? m_positionSettings.nW : 0;
	m_nH             = m_bUseSize ? m_positionSettings.nH : 0;

	m_bSnapToEdges   = (m_positionSettings.nSnapDistance != -1);
	if (!m_bSnapToEdges) m_positionSettings.nSnapDistance = 0;

	m_comboDocking.SetCurSel(static_cast<int>(m_positionSettings.dockPosition) + 1);
	m_comboZOrder.SetCurSel(static_cast<int>(m_positionSettings.zOrder));

	CUpDownCtrl	spin;
	UDACCEL udAccel;

	spin.Attach(GetDlgItem(IDC_SPIN_TRIM_TAB_TITLES));
	spin.SetRange(1, 100);
	spin.Detach();

	spin.Attach(GetDlgItem(IDC_SPIN_TRIM_TAB_TITLES_RIGHT));
	spin.SetRange(1, 100);
	spin.Detach();

	spin.Attach(GetDlgItem(IDC_SPIN_X));
	spin.SetRange(-2048, 2048);
	udAccel.nSec = 0;
	udAccel.nInc = 5;
	spin.SetAccel(1, &udAccel);
	spin.Detach();

	spin.Attach(GetDlgItem(IDC_SPIN_Y));
	spin.SetRange(-2048, 2048);
	udAccel.nSec = 0;
	udAccel.nInc = 5;
	spin.SetAccel(1, &udAccel);
	spin.Detach();

	spin.Attach(GetDlgItem(IDC_SPIN_W));
	spin.SetRange(-2048, 2048);
	udAccel.nSec = 0;
	udAccel.nInc = 5;
	spin.SetAccel(1, &udAccel);
	spin.Detach();

	spin.Attach(GetDlgItem(IDC_SPIN_H));
	spin.SetRange(-2048, 2048);
	udAccel.nSec = 0;
	udAccel.nInc = 5;
	spin.SetAccel(1, &udAccel);
	spin.Detach();

	spin.Attach(GetDlgItem(IDC_SPIN_SNAP));
	spin.SetRange(0, 20);
	spin.Detach();

	EnableControls();

	DoDataExchange(DDX_LOAD);
	return TRUE;
}
Esempio n. 14
0
BOOL CDialogBar::Create(CWnd* pParentWnd, LPCTSTR lpszTemplateName,
	UINT nStyle, UINT nID)
{
	ASSERT(pParentWnd != NULL);
	ASSERT(lpszTemplateName != NULL);

#ifdef _DEBUG
	// dialog template must exist and be invisible with WS_CHILD set
	if (!_AfxCheckDialogTemplate(lpszTemplateName, TRUE))
	{
		ASSERT(FALSE);          // invalid dialog template name
		PostNcDestroy();        // cleanup if Create fails too soon
		return FALSE;
	}
#endif //_DEBUG

	// allow chance to modify styles
	m_dwStyle = (nStyle & CBRS_ALL);
	CREATESTRUCT cs;
	memset(&cs, 0, sizeof(cs));
	cs.lpszClass = _afxWndControlBar;
	cs.style = (DWORD)nStyle | WS_CHILD;
	cs.hMenu = (HMENU)nID;
	cs.hInstance = AfxGetInstanceHandle();
	cs.hwndParent = pParentWnd->GetSafeHwnd();
	if (!PreCreateWindow(cs))
		return FALSE;

	// create a modeless dialog

#ifndef _AFX_NO_OCC_SUPPORT
	m_lpszTemplateName = lpszTemplateName;
#endif

	// initialize common controls
	VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTLS_REG));
	AfxDeferRegisterClass(AFX_WNDCOMMCTLSNEW_REG);

	BOOL bSuccess = CreateDlg(lpszTemplateName, pParentWnd);

#ifndef _AFX_NO_OCC_SUPPORT
	m_lpszTemplateName = NULL;
#endif

	if (!bSuccess)
		return FALSE;

	// dialog template MUST specify that the dialog
	//  is an invisible child window
	SetDlgCtrlID(nID);
	CRect rect;
	GetWindowRect(&rect);
	m_sizeDefault = rect.Size();    // set fixed size

	// force WS_CLIPSIBLINGS
	ModifyStyle(0, WS_CLIPSIBLINGS);

	if (!ExecuteDlgInit(lpszTemplateName))
		return FALSE;

	// force the size to zero - resizing bar will occur later
	SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOACTIVATE|SWP_SHOWWINDOW);

	return TRUE;
}