Dialog box problems...

Started by
5 comments, last by Endurion 18 years, 9 months ago
I've been having some trouble with a dialog box I've created and I was wondering if any of you have had a similar problem. Following is the original problem I had: Here I tried DialogBox and CreateDialog but aside from a few minor focus settings, there was no difference. Seeing as how that was clearly not working I tried out a method Carmack used on the Quake 2 Editor. He created a dialog box, looped through all the controls, saved them all into an HWND array and then created each one manually as a regular window. Now I have this: Here For this method I'm using just plain old CreateWindow and using the settings from the resource file to setup each control. Any help would be appreciated.
Advertisement
Are you using the style WS_POPUP for those?

Try WS_OVERLAPPED instead.
my_life:          nop          jmp my_life
[ Keep track of your TDD cycle using "The Death Star" ] [ Verge Video Editor Support Forums ] [ Principles of Verg-o-nomics ] [ "t00t-orials" ]
No luck... I'm currently using WS_VISIBLE | WS_OVERLAPPEDWINDOW | WS_CHILD, and it's not getting me anywhere. I tried switching to WS_POPUP, with no difference...

Originally I was creating the box like so:

case ID_TEXTURE_GENERATE:{    DialogBox(glApp->GetInstance(), MAKEINTRESOURCE(IDD_TEXTUREGENERATOR), glApp->GetWindowHandle(), (DLGPROC)TextureProc);} break;

But with the new code I tried out, I'm using this:

case ID_TEXTURE_GENERATE:{    // initialized earlier on in the application    texWin->Init();} break;...texwin.h - a window class for the texture dialog boxbool Init() {   		HWND tempWindow;		OnCreate();		tempWindow = CreateDialog(mParentInstance, (char*)IDD_TEXGENERATION, mParent, (DLGPROC)NULL);		if (!tempWindow)			return false;		GetControls(tempWindow);		DestroyWindow(tempWindow);		ShowWindow(mWnd, SW_SHOW);		SetActiveWindow(mWnd);		SetForegroundWindow(mWnd);		UpdateWindow(mWnd);		RedrawWindow(mWnd, NULL, NULL, RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_ERASENOW);}bool OnCreate() {		WNDCLASS wc;		memset(&wc, 0, sizeof(wc));		wc.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);		wc.cbClsExtra = 0;		wc.cbWndExtra = 0;		wc.style = 0;		wc.hCursor = LoadCursor(NULL, IDC_ARROW);		wc.hIcon = 0;		wc.lpszMenuName = NULL;		wc.lpszClassName = TEXWINCLASS;		wc.lpfnWndProc = (WNDPROC)TextureProc;		wc.hInstance = mParentInstance;		if (!RegisterClass(&wc)) {			return false;		}		if (!(mWnd = CreateWindow(TEXWINCLASS, "Texture", WS_OVERLAPPED | WS_VISIBLE | WS_CAPTION | WS_CHILD,			20, 20, 300, 250, mParent, 0, mParentInstance, NULL))) {			return false;		}		if (!mWnd) {			return false;		}		return true;}CTextureWindow(HWND parent, HWND parentInstance) {   mParent = parent;   mParentInstance = parentInstance;}


So, I don't know what I'm doing wrong... :\
I would like to help but I'm not sure what you are trying to do.
I'm pretty sure the problem is the WS_CHILD style. You won't get that going to have the controls embedded easily in your window if you're using 3d acceleration. I'm not sure if that's what you're actually trying.

Wouldn't you want a free floating dialog?

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

I've tried it with and without WS_CHILD with no apparent difference. And I don't think the child setting has anything to do with a floating window or not.
What exactly is it you're trying to do?

Your texwin class creates two windows, one modeless window (with WS_CHILD?) and a dialog which gets destroyed two lines later.
What does GetControls do? Is it supposed to copy/move the controls from the dialog to the window from texwin? Why not directly use CreateDialog but instead the copying of the controls?

With WS_CHILD your window gets embedded in the main application, without it can be free floating/dragged.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

This topic is closed to new replies.

Advertisement