- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi,
i want to display a dialog boxes created in a SDI. i will create it as i click IDM_NEW pop-up menu. user will do some work on this dialog box. and after some calculation, the result will be displayed in a graph on SDI client area. i manage to call the dialog box like this;
...
interface
function CreateChildDialog(hwndParent) result (dlg)
use dflogm
integer*4 hwndParent
type(dialog) dlg
end function
subroutine ResizeChildDialog(hwndParent, dlg)
use dflogm
integer*4 hwndParent
type(dialog) dlg
end subroutine
...
end interface
...
case (IDM_NEW)
gdlg = CreateChildDialog(hwnd)
CALL ResizeChildDialog(hwnd, gdlg)
MainWndProc = 0
return
...
!****************************************************************************
!
! FUNCTION: CreateChildDialog (HWND)
!
! PURPOSE: Create the child dialog
!
! COMMENTS: This is the window which will fill the client area of the
! main application window. Note that this dialog is defined to
! have the WS_CHILD style, rather than the WS_POPUP style
! that is normally used for dialog boxes.
!
!**********************************************************type (dialog) function CreateChildDialog(hwndParent)
use dfwin
use dflogm
use dfcomty
use dfcom
use dfauto
use win13Globals
implicit none
integer*4 hwndParent
include 'resource.fd'
external win13Sub
external win13ChangeSize
! Variables
type (T_MSG) mesg
integer*4 ret
logical*4 lret
! Create the dialog box
lret = DlgInit(IDD_DIALOG1, gdlg)
! Set up callbacks so that we get control when the
!dialog box is
! created, destroyed, and changes size
! Child dialog boxes are displayed using DlgModeless
lret = DlgModeless(gdlg, SW_SHOWNA, hwndParent)
! Set the return value
CreateChildDialog = gdlg
end
!*******************************************************!
! FUNCTION: ResizeChildDialog (HWND, dialog)
!
! PURPOSE: Resize the child dialog
!
! COMMENTS: This routine is called when the main
!application window
! receives a WM_SIZE message. This routine
!resizes the dialog
! box window to fill the main application
!window's client area.
!
!****************************************************************************
subroutine ResizeChildDialog(hwndParent, dlg)
use dfwin
use dfwinty
use dflogm
implicit none
integer*4 hwndParent
type (dialog) dlg
logical*4 lret
integer uFlags, bx, by
type (T_RECT) rect
! Get the size of a window border
bx = GetSystemMetrics(SM_CXBORDER)
by = GetSystemMetrics(SM_CYBORDER)
! Get the size of the client area of the main
!application window
lret = GetClientRect(hwndParent, rect)
! Resize the dialog box
uFlags = SWP_NOACTIVATE .OR. SWP_NOOWNERZORDER
lret = SetWindowPos( &
dlg % hWnd, & ! handle to window
HWND_TOP, & ! placement-order handle
bx, & ! horizontal position
by, & ! vertical position
rect % right - (2*bx), & ! width
rect % bottom - (22*by), & ! height
uFlags ) ! window-positioning flags);
end
...
MY PROBLEM is
1. i cant manage to seal between SDI window and dialog box. and its dimension exceeds the dimension of SDI client area. how can i manage it?
2. is it possible to draw obtained datas from dialog box by user inputs on the SDI client area?
thank you...
i want to display a dialog boxes created in a SDI. i will create it as i click IDM_NEW pop-up menu. user will do some work on this dialog box. and after some calculation, the result will be displayed in a graph on SDI client area. i manage to call the dialog box like this;
...
interface
function CreateChildDialog(hwndParent) result (dlg)
use dflogm
integer*4 hwndParent
type(dialog) dlg
end function
subroutine ResizeChildDialog(hwndParent, dlg)
use dflogm
integer*4 hwndParent
type(dialog) dlg
end subroutine
...
end interface
...
case (IDM_NEW)
gdlg = CreateChildDialog(hwnd)
CALL ResizeChildDialog(hwnd, gdlg)
MainWndProc = 0
return
...
!****************************************************************************
!
! FUNCTION: CreateChildDialog (HWND)
!
! PURPOSE: Create the child dialog
!
! COMMENTS: This is the window which will fill the client area of the
! main application window. Note that this dialog is defined to
! have the WS_CHILD style, rather than the WS_POPUP style
! that is normally used for dialog boxes.
!
!**********************************************************type (dialog) function CreateChildDialog(hwndParent)
use dfwin
use dflogm
use dfcomty
use dfcom
use dfauto
use win13Globals
implicit none
integer*4 hwndParent
include 'resource.fd'
external win13Sub
external win13ChangeSize
! Variables
type (T_MSG) mesg
integer*4 ret
logical*4 lret
! Create the dialog box
lret = DlgInit(IDD_DIALOG1, gdlg)
! Set up callbacks so that we get control when the
!dialog box is
! created, destroyed, and changes size
! Child dialog boxes are displayed using DlgModeless
lret = DlgModeless(gdlg, SW_SHOWNA, hwndParent)
! Set the return value
CreateChildDialog = gdlg
end
!*******************************************************!
! FUNCTION: ResizeChildDialog (HWND, dialog)
!
! PURPOSE: Resize the child dialog
!
! COMMENTS: This routine is called when the main
!application window
! receives a WM_SIZE message. This routine
!resizes the dialog
! box window to fill the main application
!window's client area.
!
!****************************************************************************
subroutine ResizeChildDialog(hwndParent, dlg)
use dfwin
use dfwinty
use dflogm
implicit none
integer*4 hwndParent
type (dialog) dlg
logical*4 lret
integer uFlags, bx, by
type (T_RECT) rect
! Get the size of a window border
bx = GetSystemMetrics(SM_CXBORDER)
by = GetSystemMetrics(SM_CYBORDER)
! Get the size of the client area of the main
!application window
lret = GetClientRect(hwndParent, rect)
! Resize the dialog box
uFlags = SWP_NOACTIVATE .OR. SWP_NOOWNERZORDER
lret = SetWindowPos( &
dlg % hWnd, & ! handle to window
HWND_TOP, & ! placement-order handle
bx, & ! horizontal position
by, & ! vertical position
rect % right - (2*bx), & ! width
rect % bottom - (22*by), & ! height
uFlags ) ! window-positioning flags);
end
...
MY PROBLEM is
1. i cant manage to seal between SDI window and dialog box. and its dimension exceeds the dimension of SDI client area. how can i manage it?
2. is it possible to draw obtained datas from dialog box by user inputs on the SDI client area?
thank you...
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, didn't get what do you mean by "seal"? And what's it supposed to be like? Are you trying to make the dialog kind of "dockable", i.e. sticked to the parent's client area?
First, note that the WS_POPUP vs. WS_CHILD style of the dialog box (you can specify it in "Style" combo box of resource editor) makes a big difference. Popup dialogs are always on top of their parent, no matter what you do; their coordinates are always expressed relative to screen. Child dialog is always embedded within parent's area and they're clipped when the dialog is resized; their coordinates are relative to parent client area.
Do you call ResizeChildDialog on parent's WM_SIZE?
Jugoslav
First, note that the WS_POPUP vs. WS_CHILD style of the dialog box (you can specify it in "Style" combo box of resource editor) makes a big difference. Popup dialogs are always on top of their parent, no matter what you do; their coordinates are always expressed relative to screen. Child dialog is always embedded within parent's area and they're clipped when the dialog is resized; their coordinates are relative to parent client area.
Do you call ResizeChildDialog on parent's WM_SIZE?
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi,
I meant to navigate between all opened windows, and send them at the bottom of the SDI window. As you said, I want them to stick to the parent's client area.
I have tried Password and Currency example. they call a new dialog boxes, but you can not navigate through the window. i also tried to change dialog box style. but no change.
plus, i call ResizeChildDialog within case(IDM_NEW), not in WM_SIZE. this habit remained from previous samples, i open a window and initiate a dialog box on parent's window. it was working efficiently as i resized the parent window.
thank you, Jugoslav
I meant to navigate between all opened windows, and send them at the bottom of the SDI window. As you said, I want them to stick to the parent's client area.
I have tried Password and Currency example. they call a new dialog boxes, but you can not navigate through the window. i also tried to change dialog box style. but no change.
plus, i call ResizeChildDialog within case(IDM_NEW), not in WM_SIZE. this habit remained from previous samples, i open a window and initiate a dialog box on parent's window. it was working efficiently as i resized the parent window.
thank you, Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please define "navigate" :-). Sorry, I still don't see what the problem is.
If you call ResizeChildDialog from case(IDM_NEW), it will be moved/resized once, after creation. If you move/size the parent window afterwards, it will behave depending on its style like:
* For WS_POPUP (default)
- will stay in fixed screen position
- will remain of fixed size
- will always be on top of the parent window
* For WS_CHILD:
- will move along with parent window
- will remain of fixed size (but clipped if necessary)
- will remain within parent's client area.
In general, for modeless dialogs to be sensitive to keyboard keys (Tab, Enter), you must call DlgIsDlgMessage() within your message loop (see sample on DlgIsDlgMessage).
If there any WS_CHILD dialogs, you should add WS_CLIPCHILDREN style to the parent's CreateWindow call (to avoid drawing conflicts).
Jugoslav
If you call ResizeChildDialog from case(IDM_NEW), it will be moved/resized once, after creation. If you move/size the parent window afterwards, it will behave depending on its style like:
* For WS_POPUP (default)
- will stay in fixed screen position
- will remain of fixed size
- will always be on top of the parent window
* For WS_CHILD:
- will move along with parent window
- will remain of fixed size (but clipped if necessary)
- will remain within parent's client area.
In general, for modeless dialogs to be sensitive to keyboard keys (Tab, Enter), you must call DlgIsDlgMessage() within your message loop (see sample on DlgIsDlgMessage).
If there any WS_CHILD dialogs, you should add WS_CLIPCHILDREN style to the parent's CreateWindow call (to avoid drawing conflicts).
Jugoslav

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page