Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Dialog Tab Control Help

loadpoint
Beginner
374 Views
Hi
Im having some problems setting up a dialog tab control. I have modified the Angle example program and added a tab control to the dialog resource called 100. I have added the following code to the WM_CREATE message but the tab control displays nothing.
lret = DlgInit(100, gdlg)
lret = DlgSet(gdlg, IDC_TAB, 2,DLG_NUMITEMS)
!!!!! lret = DlgSetSub(gdlg, IDC_TAB, ChangeTabSub)
lret = DlgSet(gdlg, IDC_TAB, "Input Parameters", 1)
lret = DlgSet(gdlg, IDC_TAB, "Output Parameters", 2)
lret = DlgSet(gdlg, IDC_TAB, IDD_TAB_DIALOG1, 1)
lret = DlgSet(gdlg, IDC_TAB, IDD_TAB_DIALOG2, 2)
I don't think I have a handle to the dialog as it is shown with the following code before I added my own code.
hwndDlg = CreateDialogParam(hInst, INT4(100), hwnd, LOC(DlgProc), 0)
hDlg = hwndDlg
lret = ShowWindow(hwndDlg, SW_SHOW)
How can I get a handle to the dialog so that I can use DlgSet()? I have attached the full code incase there is a better place to set up the tab control.
Any help greatly appreciated.
0 Kudos
3 Replies
anthonyrichards
New Contributor III
374 Views
If you use DgInit(IDD_DIALOG, Dlg) to create a dialog box, you must define Dlg as drived type TYPE DIALOG:
USE DFLOGM
type (dialog) dlg
you can thenget the dialog window handle as Dlg%hWnd.
0 Kudos
loadpoint
Beginner
374 Views
The code that shows the dialog is not lret = DlgInit(100, gdlg) but the following:
hwndDlg = CreateDialogParam(hInst, INT4(100), hwnd, LOC(DlgProc), 0)
hDlg = hwndDlg
lret = ShowWindow(hwndDlg, SW_SHOW)
How can I set up the tab control from the ShowWindow function?
0 Kudos
anthonyrichards
New Contributor III
374 Views
You apparently get the dialog handle as HwndDlg from CreateDialogParam.
To set up the dialog as you want it, you can send messages to dialog items using SendDlGItemMessage
Code:
SendDlgItemMessage(
  HWND hDlg,     &  !handle of dialog box
  int nIDDlgItem, & ! identifier of control
  UINT Msg,       & ! message to send
  WPARAM wParam,  & ! first message parameter
  LPARAM lParam   & ! second message parameter  )
All the Tab controlmessages you need , along with the parameters they require can be found by searching the Help for messages beginning TCM_ .
0 Kudos
Reply