September 17th, 2013, 09:58 AM
Dialog like Window for settings parameters
I got a main window with menu and the option settings. When I click settings a "dialog" should appear, where the user is able to set some parameters - into a global variable. This window will have something like 12 columns and 8/16/32 (this will vary) rows. This gives us plenty of controls, mostly Edit Controls, which can be filled by the user.
My question is, how to make this window effectively. I was considering dialog box modal/modeless, the problem is the way you have to define a dialog box -> resource file. Defining all the controls in a resource makes the code somehow not very flexible, when I want to change something.
I was trying to make some sort of child window, which is created as follows:
In the WM_CREATE section of the window procedure I call a function, which creates all the buttons, edit boxes etc.
HWND GT_CreateWindowMaster(HWND hParent)
WS_EX_DLGMODALFRAME | WS_EX_TOOLWINDOW, /* Extended possibilites for variation */
GA_WINDOW_MASTER, /* Classname */
"Settings - LIN Master", /* Title Text */
WS_VISIBLE | WS_OVERLAPPEDWINDOW | WS_SYSMENU | WS_CAPTION | WS_VSCROLL | WS_HSCROLL, /* default window */
0, /* Windows decides the position */
0, /* where the window ends up on the screen */
544, /* The programs width */
375, /* and height in pixels */
NULL, /* The window is a child-window to desktop */
NULL, /* No menu */
GetModuleHandle(0), /* Program Instance handler */
NULL /* No Window Creation data */
But it's not the child of the main window, which can probably cause trouble in the future (don't know right now). What is good approach to create such "complex" setting windows like in Code::Blocks for example or other pieces of SW? Is it done with dialog boxes through resources? What are the pros and cons of different approaches?
void OnCreate(HWND hParent, int iOffsets)
for(i = 1; i < NUM_ROWS; i++)
CreateIDEdit (hParent, i, 0, iOffsets);
CreateDelayEdit (hParent, i, 1, iOffsets);
CreateLengthCombo (hParent, i, 2, iOffsets);
CreateByteEdit (hParent, i, 3, iOffsets);
Thank you for advices! :-)
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.