Dialog Hell

Started by
6 comments, last by Evil Steve 18 years, 1 month ago
Okay someone may know something that I cannot find. I am trying to add a dialog to a window that I have created. This dialog will have editing features such as frames for animation etc. Also the dialogs in the other child windows will also serve as my main editors for the game. the simple question is how do you attach a dialog to the child window? I am coding in win32, c++ with no MFC. Thank ya thank ya avareh mushhhh Aviscowboy
Advertisement
It seems after looking through GameDev.Net I am seeing a lot of posts on this subject but no solutions... can someone make a tutorial on this matter?
The question doesn't make sense. What have you tried? What errors are you getting?

To create a modal dialog box call DialogBox or one of it's kin. For a modeless dialog use CreateDialog.

Petzold or pretty much any other book on basic Win32 programming will devote a couple of chapters to this sort of stuff.
-Mike
Are you asking how to launch any dialog?

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

I am trying to attach the dialog to the window
http://www.winprog.org/tutorial/
[google]
[size="2"][size=2]Mort, Duke of Sto Helit: NON TIMETIS MESSOR -- Don't Fear The Reaper
Give it the WM_CHILD attribute, which should be accessable in the dialog editor. Then when creating it give it a parent window, it'll be embedded as such. Remember coordinates follow the parent.

Hope this helps. You may wanna look into Win32 a bit more. If you're going to be doing a control the best way would probably be active x. just because that's the norm. Me I don't do it because I'm lazy, but hell the proper way to create new controls and such is with active x. That way you can take it to and from different languages.
You mean like using property pages, like this:
DruinkIM

If so, then you want to just use the WM_CHILD style when you create the dialog resource, and CreateDialog[Param](), passing the parent window as the hWndParent parameter. Here's some source snippets from my code:
bool CSettingsPage::Create(CSettingsDlg* pParent){	// Do pre-init //	m_pParent = pParent;	// Create window //	m_hWnd = CreateDialogParam(m_hInstanceTemplate,m_szTemplateID,		pParent->GetWindow(),StaticDlgProc,(LPARAM)this);	if(!m_hWnd)		return false;	// Enable tab control //	LONG lOldStyle = GetWindowLong(m_hWnd,GWL_EXSTYLE);	SetWindowLong(m_hWnd,GWL_EXSTYLE,lOldStyle | WS_EX_CONTROLPARENT);	SetWindowPos (m_hWnd,NULL,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|		SWP_FRAMECHANGED);	// Load icon //	m_hIcon = LoadIcon(m_hInstanceIcon,m_szIconID);	return true;}

The "Enable tab control" bit is so you can use the tab key to properly change controls on the child sheet.
And then to call CSettingsPage::Create():
void CSettingsDlg::OnInitDialog(){RECT rc;POINT pt;DWORD i;LVITEM theItem;STitleInfo theInfo;	// Get position of pages //	GetClientRect(m_hDlg,&rc);	pt.x = rc.left; pt.y = rc.top;	ClientToScreen(m_hDlg,&pt);	GetWindowRect(GetDlgItem(m_hDlg,IDC_POSITION),&rc);	rc.left -= pt.x; rc.right -= pt.x;	rc.top -= pt.y; rc.bottom -= pt.y;	ShowWindow(GetDlgItem(m_hDlg,IDC_POSITION),SW_HIDE);	m_bCreating = true;	// Create & move pages //	for(i=0; i<m_vPages.size(); ++i)	{		if(!m_vPages->Create(this))		{			assert(false);			continue;		}		SetWindowPos(m_vPages->GetWindow(),NULL,rc.left,rc.top,			rc.right-rc.left,rc.bottom-rc.top,SWP_NOZORDER);	}	// Snip}

This topic is closed to new replies.

Advertisement