- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Im having a problem getting a tab control form to show in a child dialog box. There are no errors when it compiles but the tab control is not visible in the program. Below is some of the code used in the program which is relevant to the tab control. Have I missed out a specific line. Cheers for any assistance.
type (dialog) function CreateChildDialog(hwndParent)
use dfwin
use dflogm
use dfcomty
use dfcom
use dfauto
use fxplorerGlobals
use browser
implicit none
integer*4 hInstance
integer*4 hPrevInstance
integer*4 lpszCmdLine
integer*4 hwndParent
integer*4 nCmdShow
include 'resource.fd'
external FXSub
external FXChangeSize
external FXGo
external FXStop
external FXBack
external FXCalc
external FXNew
external FXSave
external FXPrint
external ShowFontSub
external ChangeTabSub
! Variables
type (T_MSG) mesg
integer*4 ret
integer*4 hwnd
logical*4 lret
! ghInstance = hInstance
ghModule = GetModuleHandle(NULL)
! ghFont = NULL
!
! Create the dialog box
lret = DlgInit(IDD_FXPLORER_DIALOG, gdlg)
lret = DlgSetSub(gdlg, IDD_FXPLORER_DIALOG, ShowFontSub)
lret = DlgSetSub(gdlg, IDC_TAB, ChangeTabSub)
! Set up callbacks so that we get control when the dialog box is
! created, destroyed, and changes size
lret = DlgSetSub(gdlg, IDD_FXPLORER_DIALOG, FXSub)
lret = DlgSetSub(gdlg, IDD_FXPLORER_DIALOG, FXChangeSize, dlg_sizechange)
!Set initial tabs
lret = DlgSet(gdlg, IDC_TAB, 4)
lret = DlgSet(gdlg, IDC_TAB, "Input Parameters", 1)
lret = DlgSet(gdlg, IDC_TAB, "Pressure & Airflow Under No pressure", 2)
lret = DlgSet(gdlg, IDC_TAB, "Bearing Load-Deflection Characteristics", 3)
lret = DlgSet(gdlg, IDC_TAB, "Graph", 4)
lret = DlgSet(gdlg, IDC_TAB, IDD_TAB_DIALOG1, 1)
lret = DlgSet(gdlg, IDC_TAB, IDD_TAB_DIALOG2, 2)
lret = DlgSet(gdlg, IDC_TAB, IDD_TAB_DIALOG3, 3)
lret = DlgSet(gdlg, IDC_TAB, IDD_TAB_DIALOG4, 4)
! Initialize the tab dialog boxes
lret = DlgInit(IDD_TAB_DIALOG1, gdlg_tab1)
!lret = DlgSetSub(gdlg_tab1, IDD_TAB_DIALOG1, FamilySub)
!lret = DlgSetSub(gdlg_tab1, IDC_FAMILY_LIST, ChangeFamily)
lret = DlgInit(IDD_TAB_DIALOG2, gdlg_tab2)
!lret = DlgSetSub(gdlg_tab2, IDD_TAB_DIALOG2, StyleSub)
!lret = DlgSetSub(gdlg_tab2, IDC_STYLE_LIST, UpdateFont)
lret = DlgInit(IDD_TAB_DIALOG3, gdlg_tab3)
!lret = DlgSetSub(gdlg_tab3, IDC_SIZE_LIST, UpdateFont)
lret = DlgInit(IDD_TAB_DIALOG4, gdlg_tab4)
!lret = DlgSetSub(gdlg_tab4, IDC_SIZE_LIST, UpdateFont)
!if (callbacktype == dlg_init) then
! hwnd = GetDlgItem(dlg % hwnd, IDC_TAB)
! lret = DlgModeless(gdlg_tab1, SW_HIDE, hwnd)
! lret = DlgModeless(gdlg_tab2, SW_HIDE, hwnd)
! lret = DlgModeless(gdlg_tab3, SW_HIDE, hwnd)
! lret = DlgModeless(gdlg_tab4, SW_HIDE, hwnd)
lret = DlgModeless(gdlg, nCmdShow)
!lret = DlgSet(dlg, IDC_TAB, 1, dlg_state)
! Set up callbacks for the buttons
lret = DlgSetSub(gdlg, IDM_GO, FXGo)
lret = DlgSetSub(gdlg, IDM_STOP, FXStop)
lret = DlgSetSub(gdlg, IDC_BACK, FXBack)
lret = DlgSetSub(gdlg, IDC_CALCULATE, FXCalc)
lret = DlgSetSub(gdlg, IDC_BUTTON_NEW, FXNew)
lret = DlgSetSub(gdlg, IDC_BUTTON_PRI NT, FXPrint)
ret = DlgSetCtrlEventHandler(gdlg, IDC_EXPLORER1, &
DWebBrowserEvents2_DownloadBegin, 106, IID_DWebBrowserEvents2)
ret = DlgSetCtrlEventHandler(gdlg, IDC_EXPLORER1, &
DWebBrowserEvents2_DownloadComplete, 104, IID_DWebBrowserEvents2)
ret = DlgSetCtrlEventHandler(gdlg, IDC_EXPLORER1, &
DWebBrowserEvents2_ProgressChange, 108, IID_DWebBrowserEvents2)
ret = DlgSetCtrlEventHandler(gdlg, IDC_EXPLORER1, &
DWebBrowserEvents2_TitleChange, 113, IID_DWebBrowserEvents)
CALL DownloadInProgress(gdlg, FALSE);
! Child dialog boxes are displayed using DlgModeless
lret = DlgModeless(gdlg, SW_SHOWNA, hwndParent)
! Set the return value
CreateChildDialog = gdlg
end
!****************************************************************************
!
! FUNCTION: ShowFontSub ( dlg, id, callbacktype )
!
! PURPOSE: Main dialog box callback for initialization and destroy
!
! COMMENTS:
!
!****************************************************************************
SUBROUTINE ShowFontSub( dlg, id, callbacktype )
use dfwin
use dflogm
use fxplorerGlobals
implicit none
include 'resource.fd'
type (dialog) dlg
integer id, callbacktype
integer hwnd
logical lret
! When the Main dialog box is first displayed, call DlgModeless to
! display the tab dialog boxes. Note the use of SW_HIDE. The
! Dialog Functions will "show" the proper tab dialog box.
if (callbacktype == dlg_init) then
hwnd = GetDlgItem(dlg % hwnd, IDC_TAB)
lret = DlgModeless(gdlg_tab1, SW_HIDE, hwnd)
lret = DlgModeless(gdlg_tab2, SW_HIDE, hwnd)
lret = DlgModeless(gdlg_tab3, SW_HIDE, hwnd)
lret = DlgModeless(gdlg_tab4, SW_HIDE, hwnd)
! Note that we must set the default tab after the calls to
! DlgModeless. Otherwise, no tab dialog box will be displayed
! initially.
lret = DlgSet(dlg, IDC_TAB, 1, dlg_state)
! call ChangeFamily(gdlg_tab1, IDC_FAMILY_LIST, DLG_SELCHANGE)
! When the user presses the "Exit" button, the default callback
! calls DLGEXIT which calls this callback with
! callbacktype == dlg_destroy. We call PostQuitMessage to cause
! the message loop in WinMain to terminate.
else if (callbacktype == dlg_destroy) then
call PostQuitMessage(0)
endif
END SUBROUTINE ShowFontSub
!****************************************************************************
!
! FUNCTION: ChangeTabSub ( dlg, id, callbacktype )
!
! PURPOSE: Callback when a tab is selected
!
! COMMENTS:
!
!****************************************************************************
SUBROUTINE ChangeTabSub( dlg, id, callbacktype )
use dfwin
use dflogm
use fxplorerGlobals
implicit none
include 'resource.fd'
type (dialog) dlg
integer id, callbacktype
logical lret
integer iTab, idTab, hwnd
! Set the window focus to the list box of the selected tab dialog box
lret = DlgGet(dlg, id, iTab, dlg_state)
lret = DlgGet(dlg, id, idTab, iTab)
select case (idTab)
case (IDD_TAB_DIALOG1)
! hwnd = GetDlgItem(gdlg_tab1 % hwnd, IDC_FAMILY_LIST)
case (IDD_TAB_DIALOG2)
! hwnd = GetDlgItem(gdlg_tab2 % hwnd, IDC_STYLE_LIST)
case (IDD_TAB_ DIALOG3)
! hwnd = GetDlgItem(gdlg_tab3 % hwnd, IDC_SIZE_LIST)
case (IDD_TAB_DIALOG4)
! hwnd = GetDlgItem(gdlg_tab4 % hwnd, IDC_SIZE_LIST)
end select
hwnd = SetFocus(hwnd)
END SUBROUTINE ChangeTabSub
type (dialog) function CreateChildDialog(hwndParent)
use dfwin
use dflogm
use dfcomty
use dfcom
use dfauto
use fxplorerGlobals
use browser
implicit none
integer*4 hInstance
integer*4 hPrevInstance
integer*4 lpszCmdLine
integer*4 hwndParent
integer*4 nCmdShow
include 'resource.fd'
external FXSub
external FXChangeSize
external FXGo
external FXStop
external FXBack
external FXCalc
external FXNew
external FXSave
external FXPrint
external ShowFontSub
external ChangeTabSub
! Variables
type (T_MSG) mesg
integer*4 ret
integer*4 hwnd
logical*4 lret
! ghInstance = hInstance
ghModule = GetModuleHandle(NULL)
! ghFont = NULL
!
! Create the dialog box
lret = DlgInit(IDD_FXPLORER_DIALOG, gdlg)
lret = DlgSetSub(gdlg, IDD_FXPLORER_DIALOG, ShowFontSub)
lret = DlgSetSub(gdlg, IDC_TAB, ChangeTabSub)
! Set up callbacks so that we get control when the dialog box is
! created, destroyed, and changes size
lret = DlgSetSub(gdlg, IDD_FXPLORER_DIALOG, FXSub)
lret = DlgSetSub(gdlg, IDD_FXPLORER_DIALOG, FXChangeSize, dlg_sizechange)
!Set initial tabs
lret = DlgSet(gdlg, IDC_TAB, 4)
lret = DlgSet(gdlg, IDC_TAB, "Input Parameters", 1)
lret = DlgSet(gdlg, IDC_TAB, "Pressure & Airflow Under No pressure", 2)
lret = DlgSet(gdlg, IDC_TAB, "Bearing Load-Deflection Characteristics", 3)
lret = DlgSet(gdlg, IDC_TAB, "Graph", 4)
lret = DlgSet(gdlg, IDC_TAB, IDD_TAB_DIALOG1, 1)
lret = DlgSet(gdlg, IDC_TAB, IDD_TAB_DIALOG2, 2)
lret = DlgSet(gdlg, IDC_TAB, IDD_TAB_DIALOG3, 3)
lret = DlgSet(gdlg, IDC_TAB, IDD_TAB_DIALOG4, 4)
! Initialize the tab dialog boxes
lret = DlgInit(IDD_TAB_DIALOG1, gdlg_tab1)
!lret = DlgSetSub(gdlg_tab1, IDD_TAB_DIALOG1, FamilySub)
!lret = DlgSetSub(gdlg_tab1, IDC_FAMILY_LIST, ChangeFamily)
lret = DlgInit(IDD_TAB_DIALOG2, gdlg_tab2)
!lret = DlgSetSub(gdlg_tab2, IDD_TAB_DIALOG2, StyleSub)
!lret = DlgSetSub(gdlg_tab2, IDC_STYLE_LIST, UpdateFont)
lret = DlgInit(IDD_TAB_DIALOG3, gdlg_tab3)
!lret = DlgSetSub(gdlg_tab3, IDC_SIZE_LIST, UpdateFont)
lret = DlgInit(IDD_TAB_DIALOG4, gdlg_tab4)
!lret = DlgSetSub(gdlg_tab4, IDC_SIZE_LIST, UpdateFont)
!if (callbacktype == dlg_init) then
! hwnd = GetDlgItem(dlg % hwnd, IDC_TAB)
! lret = DlgModeless(gdlg_tab1, SW_HIDE, hwnd)
! lret = DlgModeless(gdlg_tab2, SW_HIDE, hwnd)
! lret = DlgModeless(gdlg_tab3, SW_HIDE, hwnd)
! lret = DlgModeless(gdlg_tab4, SW_HIDE, hwnd)
lret = DlgModeless(gdlg, nCmdShow)
!lret = DlgSet(dlg, IDC_TAB, 1, dlg_state)
! Set up callbacks for the buttons
lret = DlgSetSub(gdlg, IDM_GO, FXGo)
lret = DlgSetSub(gdlg, IDM_STOP, FXStop)
lret = DlgSetSub(gdlg, IDC_BACK, FXBack)
lret = DlgSetSub(gdlg, IDC_CALCULATE, FXCalc)
lret = DlgSetSub(gdlg, IDC_BUTTON_NEW, FXNew)
lret = DlgSetSub(gdlg, IDC_BUTTON_PRI NT, FXPrint)
ret = DlgSetCtrlEventHandler(gdlg, IDC_EXPLORER1, &
DWebBrowserEvents2_DownloadBegin, 106, IID_DWebBrowserEvents2)
ret = DlgSetCtrlEventHandler(gdlg, IDC_EXPLORER1, &
DWebBrowserEvents2_DownloadComplete, 104, IID_DWebBrowserEvents2)
ret = DlgSetCtrlEventHandler(gdlg, IDC_EXPLORER1, &
DWebBrowserEvents2_ProgressChange, 108, IID_DWebBrowserEvents2)
ret = DlgSetCtrlEventHandler(gdlg, IDC_EXPLORER1, &
DWebBrowserEvents2_TitleChange, 113, IID_DWebBrowserEvents)
CALL DownloadInProgress(gdlg, FALSE);
! Child dialog boxes are displayed using DlgModeless
lret = DlgModeless(gdlg, SW_SHOWNA, hwndParent)
! Set the return value
CreateChildDialog = gdlg
end
!****************************************************************************
!
! FUNCTION: ShowFontSub ( dlg, id, callbacktype )
!
! PURPOSE: Main dialog box callback for initialization and destroy
!
! COMMENTS:
!
!****************************************************************************
SUBROUTINE ShowFontSub( dlg, id, callbacktype )
use dfwin
use dflogm
use fxplorerGlobals
implicit none
include 'resource.fd'
type (dialog) dlg
integer id, callbacktype
integer hwnd
logical lret
! When the Main dialog box is first displayed, call DlgModeless to
! display the tab dialog boxes. Note the use of SW_HIDE. The
! Dialog Functions will "show" the proper tab dialog box.
if (callbacktype == dlg_init) then
hwnd = GetDlgItem(dlg % hwnd, IDC_TAB)
lret = DlgModeless(gdlg_tab1, SW_HIDE, hwnd)
lret = DlgModeless(gdlg_tab2, SW_HIDE, hwnd)
lret = DlgModeless(gdlg_tab3, SW_HIDE, hwnd)
lret = DlgModeless(gdlg_tab4, SW_HIDE, hwnd)
! Note that we must set the default tab after the calls to
! DlgModeless. Otherwise, no tab dialog box will be displayed
! initially.
lret = DlgSet(dlg, IDC_TAB, 1, dlg_state)
! call ChangeFamily(gdlg_tab1, IDC_FAMILY_LIST, DLG_SELCHANGE)
! When the user presses the "Exit" button, the default callback
! calls DLGEXIT which calls this callback with
! callbacktype == dlg_destroy. We call PostQuitMessage to cause
! the message loop in WinMain to terminate.
else if (callbacktype == dlg_destroy) then
call PostQuitMessage(0)
endif
END SUBROUTINE ShowFontSub
!****************************************************************************
!
! FUNCTION: ChangeTabSub ( dlg, id, callbacktype )
!
! PURPOSE: Callback when a tab is selected
!
! COMMENTS:
!
!****************************************************************************
SUBROUTINE ChangeTabSub( dlg, id, callbacktype )
use dfwin
use dflogm
use fxplorerGlobals
implicit none
include 'resource.fd'
type (dialog) dlg
integer id, callbacktype
logical lret
integer iTab, idTab, hwnd
! Set the window focus to the list box of the selected tab dialog box
lret = DlgGet(dlg, id, iTab, dlg_state)
lret = DlgGet(dlg, id, idTab, iTab)
select case (idTab)
case (IDD_TAB_DIALOG1)
! hwnd = GetDlgItem(gdlg_tab1 % hwnd, IDC_FAMILY_LIST)
case (IDD_TAB_DIALOG2)
! hwnd = GetDlgItem(gdlg_tab2 % hwnd, IDC_STYLE_LIST)
case (IDD_TAB_ DIALOG3)
! hwnd = GetDlgItem(gdlg_tab3 % hwnd, IDC_SIZE_LIST)
case (IDD_TAB_DIALOG4)
! hwnd = GetDlgItem(gdlg_tab4 % hwnd, IDC_SIZE_LIST)
end select
hwnd = SetFocus(hwnd)
END SUBROUTINE ChangeTabSub
링크가 복사됨
2 응답
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Hmm, I have no clue just looking at the code -- it looks OK -- but here's how I'd debug it:
- Run the application and use Spy++ from CVF program group. Click on "Window Search" button and drag the pointer to your dialog. Your dialog will be highlighted in Spy++ window tree view.
- Click the + sign in the tree view to expand its child windows. Is the Tab there? (SysTabControl32)
- If it isn't, something must have destroyed it
- If it is, double-click it and see if it has WS_VISIBLE style in its window styles; if it hasn't, something has hidden it.
Further, I'd try to narrow down the problem by first removing the ActiveX controls from the dialog and commenting out their handling code. Also, try stepping through the debugger and check all the lrets.
There's one of Murphy's laws on programming -- roughly
"A big working program must have originated from a small working program; any attempt to make a big program working from the start is doomed to fail". :-).
Jugoslav
- Run the application and use Spy++ from CVF program group. Click on "Window Search" button and drag the pointer to your dialog. Your dialog will be highlighted in Spy++ window tree view.
- Click the + sign in the tree view to expand its child windows. Is the Tab there? (SysTabControl32)
- If it isn't, something must have destroyed it
- If it is, double-click it and see if it has WS_VISIBLE style in its window styles; if it hasn't, something has hidden it.
Further, I'd try to narrow down the problem by first removing the ActiveX controls from the dialog and commenting out their handling code. Also, try stepping through the debugger and check all the lrets.
There's one of Murphy's laws on programming -- roughly
"A big working program must have originated from a small working program; any attempt to make a big program working from the start is doomed to fail". :-).
Jugoslav
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
...ah, also, what happens if you replace DlgModeless with DlgModal for the main dialog?
