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

Tabbed controls

hcra
Beginner
605 Views
Hi,
I'm using Visual Fortran 6.6 and I'm having the following problem.I have made a dialog with a tab control. I want to change between the fields of the child dialogs using the TAB button. I can't move between the buttons and fields in the child dialog. I have used the Dialogboxparam to create the main dialogbox with the tab control and createdialogparam to create child dialogboxes(with their style set to 'child'). I saw that Jugoslav has provided a solution to this problem using xflogm, but is there a solution to this when Dialogboxparam, and createdialogparam functions are used. Is'nt there some way by which the dialogproc of the childwindow in focus could be invoked when the 'TAB' key is clicked.
Thanks,

Archana
0 Kudos
6 Replies
Jugoslav_Dujic
Valued Contributor II
605 Views
The only trick is to use main dialog as parent to modeless child dialogs, not the tab control, i.e.
CASE WM_INITDIALOG
  hChild(i) = CreateDialogParam(hInst,IDD_CHILD1,hWnd...)


The only other concern is how to adjust the position of child dialogs correctly. Take a look on XFLOGM for that (search for TCM_ADJUSTRECT).

Jugoslav
0 Kudos
hcra
Beginner
605 Views
Hi,
Thanks for the tip.I was able to center the modeless dialog boxes created using createdialog function. However I was not able to switch between controls in my dialog when tab key was pressed. The main dialogbox(that contains the tab control) receives a WM_NOTIFY(TCN_KEYDOWN)message when up arrow key is pressed. The tab stop option for the parent containing the tabbed control is set to false. What should be done to enable focus on each control within a child dialogbox when tab key is pressed.Thanks,
Archana.
0 Kudos
Jugoslav_Dujic
Valued Contributor II
605 Views
Did you set "Control" (DS_CONTROL) style to child dialogs?
0 Kudos
hcra
Beginner
605 Views
Thanks,that was exactly the problem.The more style option 'Control' was not set for the child windows.
Archana
0 Kudos
vinuka
Beginner
605 Views
Hi there!
Im facing the same problem that almost everybody that wants to use tab controls and tab key together faces!
But i just couldnt achieve the spot... ive read that i must "link" the child windows to the main dialog and not to the "IDD_TAB"... but i dont know how to do that... i couldnt use "CreateDialogParam" (in which library is it?).
And when/where do i need to make this "link"? everytime, just once, in the "MyAppSub" subroutine...?
i couldt use TCM_ADJUSTRECT, and i dont know how to handle the messages like WM_INITDIALOG and so on...
any help will be excellent!
sorry for my ignorance! =)
Vinicius
0 Kudos
Jugoslav_Dujic
Valued Contributor II
605 Views
Vinicius,
We were talking about Win32-handled dialogs. You can't do it with DFLOGM... or maybe you can?

This might be possible if you manage to set up WS_EX_CONTROLPARENT extended style for the tab control. I'm not at my computer at the moment so I can't see whether it does exist on Tab's proparty page. In any case, it should be possible using


integer:: hTab

hTab = GetDlgItem(Dlg%hWnd, IDC_TAB1)
iStyle = GetWindowLong(hTab, GWL_EXSTYLE)
ret = SetWindowLong(hTab, GWL_EXSTYLE, IOR(iStyle, WS_EX_CONTROLPARENT))


Also, IIRC, that same style should be set up for child dialogs, along with DS_CONTROL ("control"). Try both combinations & please let me know if it works.

Jugoslav
0 Kudos
Reply