Jump to content
  • Advertisement
Sign in to follow this  
VanillaSnake21

Dialog Boxes

This topic is 4254 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm having trouble making my dialog box show up. It whows up but it's sort of embedded within a window for some reason. What I mean is that instead of having it's own window so I can move it around, it simply puts all the controls that were in a dialog box, into a the parents' window client area. I'm not using MFC classes . Does anyone know what the problem might be? Thanks

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Colin Jeanne
Sounds like you're setting the WS_CHILD style somewhere. Can you post the code where you create the dialog?


Thats what I get, it looks like the Dialog Box is inside the window, but when I took a screenshot of an active window while the dialog was displayed, the software took a screenshot of the dialog box, but it had no frames or borders just white around the controls, that means that it's actually a window, but something is wrong with the style? Also I tried to find FromBorderstyle in the dialog editor (im using VS 2003) but didn't find that property. Maybe something is wrong with the type of a Diolog that I created? (There were 4 categories in the resource manager, I chose the standard dialog).

Image Hosted by ImageShack.us

this is the source for the dialog as created by VS (in .rc file)

[source = cpp]

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_DIALOG1 DIALOGEX 0, 0, 253, 247
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_THICKFRAME
EXSTYLE WS_EX_OVERLAPPEDWINDOW | WS_EX_TOOLWINDOW
CAPTION "Grid Size"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,12,226,50,14
PUSHBUTTON "Cancel",IDCANCEL,162,226,50,14
CONTROL "By Image Size",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,
12,18,60,8
LTEXT "___________________________________________________________",
IDC_STATIC,6,30,237,8
LTEXT "Image Dimensions:",IDC_STATIC,6,48,60,8
LTEXT "X:",IDC_STATIC,12,60,8,8
EDITTEXT IDC_EDIT2,30,60,30,12,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "Y:",IDC_STATIC,12,78,8,8
EDITTEXT IDC_EDIT3,30,78,30,12,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "Num Images:",IDC_STATIC,78,60,43,8
EDITTEXT IDC_EDIT4,126,60,30,12,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "Every N Pixels",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,
12,108,60,12
LTEXT "___________________________________________________________",
IDC_STATIC,6,126,237,8
LTEXT "X:",IDC_STATIC,12,144,8,8
LTEXT "Y:",IDC_STATIC,12,168,8,8
EDITTEXT IDC_EDIT5,30,144,30,12,ES_AUTOHSCROLL | ES_NUMBER
EDITTEXT IDC_EDIT6,30,168,30,12,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "Inclusive",IDC_CHECK1,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,90,144,44,10
CONTROL "1 Pixel Offset",IDC_CHECK2,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,90,168,59,10
END




I call it with

case WM_COMMAND:
{
if(LOWORD(wparam == ID_OPTIONS_GRIDSIZE))
if(DialogBox(g_hinst, MAKEINTRESOURCE(IDD_DIALOG1), g_hwnd, MyDialogProc) <= 0)
MessageBox(NULL, 0, "DB Create Failed", MB_OK);
} break;

from inside WinProc()

maybe the hInstance, required by DialogBox() is the wrong one? To get it I declare a global HINSTANCE g_hinst, and say g_hinst = hInstance; on the first line of WinMain()

Share this post


Link to post
Share on other sites
well for one thing your line:

if(LOWORD(wparam == ID_OPTIONS_GRIDSIZE))

should be

if(LOWORD(wparam) == ID_OPTIONS_GRIDSIZE)

and i'd get rid of the WS_EX_TOOLWINDOW extended dialog box style and the WS_OVERLAPPEDWINDOW style as well, plus i'd check your dialog procedure to see if you are doing something funky with the WM_CTLCOLORDLG message (logic errors in your dialog procedure can cause weird painting bugs in your dialog as well). but since u seem to be calling DialogBox correctly, i think ur main problem is with your dialog template, having kind of an odd set of dialog style flags you have there. i would switch to a DIALOG template rather than a DIALOGEX template, get rid of those extended flags, get rid of the FONT line and the DS_FONT flag and see what happens.

Share this post


Link to post
Share on other sites
Quote:
Original post by yadango
well for one thing your line:

if(LOWORD(wparam == ID_OPTIONS_GRIDSIZE))

should be

if(LOWORD(wparam) == ID_OPTIONS_GRIDSIZE)

and i'd get rid of the WS_EX_TOOLWINDOW extended dialog box style and the WS_OVERLAPPEDWINDOW style as well, plus i'd check your dialog procedure to see if you are doing something funky with the WM_CTLCOLORDLG message (logic errors in your dialog procedure can cause weird painting bugs in your dialog as well). but since u seem to be calling DialogBox correctly, i think ur main problem is with your dialog template, having kind of an odd set of dialog style flags you have there. i would switch to a DIALOG template rather than a DIALOGEX template, get rid of those extended flags, get rid of the FONT line and the DS_FONT flag and see what happens.


K, tried most of the stuff, even created a brand new dialog template with all the default falues, same results, right now I'm pretty sure that my problem lies somewhere in the calling of the actual template, I took a look at an example of a Dialog app, that uses MFC and they do some extra stuff to repaint the box. Are there any examples somewhere that create DBs without MFC?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!