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

Registercard (tab object) in QuickWin application

onkelhotte
New Contributor II
743 Views
Hi there,
I have a problem to place text and buttons on a registercard in a dialog with Visual Fortran 6.1. I created a new Dialog IDD_DIALOG1 and placed a registercard on it, IDC_TAB1. When I want to place text or buttons on that tab, they will be placed on the Dialog, not on the tab.
Can anybody help me?

cu,
OnkelHotte
0 Kudos
4 Replies
Jugoslav_Dujic
Valued Contributor II
743 Views
No, that's not the way to do it.
The typical setup for a tabbed dialog is that you define one "main" dialog containing only the Tab control (+OK & Cancel buttons) and n borderless, modeless "child" dialogs which actually contain the other controls. Each of these dialogs is then assigned to appropriate tab page and automatically shown/hidden by DFLOGM when the active tab changes.
There's a CVF sample describing the technique -- I think SHOWFONT.
Jugoslav

Message Edited by JugoslavDujic on 06-21-2004 05:43 PM

0 Kudos
onkelhotte
New Contributor II
743 Views

Thanks, now it works.

Now I have another problem :-) When I test the tabbed dialogs, I can use the tab-key to switch between the controls on that dialog. But when I start the program and press the tab-key, it only switches between OK and Cancel on the main dialog, not between the controls of the tabbed dialog. Is there a way to switch between the controls of the tabbed dialog and after them to the OK/Cancel button or is that not possible because they are on two different dialogs?

Markus

0 Kudos
Jugoslav_Dujic
Valued Contributor II
743 Views

It's solved in my XFLOGM:

http://www.geocities.com/jdujic/fortran/xflogm/xflogmref.htm

(see pink text at the bottom of the page)

Jugoslav
0 Kudos
Jugoslav_Dujic
Valued Contributor II
743 Views

Markus, I received & replied to your e-mail, but your mail daemon looks more paranoid than Intel Premier Support >:):

[Denied content]

Profanity or Spam content were detected (Core)

So, for eventual reuse by other users, here it is:

| Your
| modifications helped me very much to implement the tab routines in my
| program. I just started here at this company and I never programmed Fortran
| before, so it is a little bit difficult for me to get used to it. But you
| helped me a lot, thank you very much for your help!
| With your module XFLOGM I can switch now between the controls on my tab
| dialog. Is it possible to go to the next edit control, when I press return
| in one edit control? At first, I had to disable to IDOK Button, because
| pressing return ended the dialog. But now the cursor remains on the edit
| field and will not go to the next, when I press enter. But switching with
| the tab key works great!

This used to be answered too on my home page, on "Win32 FAQ" page but now I saw I accidentaly deleted it when I was fighting FrontPage 2003 bugs...
grrr...

In short, you have to have a default button whose callback will automatically be pulled on Enter, so you can handle it. That means you should enable OK button, but remove "Default button" style from it. Then, create another button, e.g. IDC_DEFAULT, with "Default button" style, and make it hidden (not visible). Then, make a callback for it, e.g. OnDefaultButton(Dlg, Id, iEvent) -- note that it can be invoked only via Enter key, since it's hidden.

The callback should look like:

subroutine OnDefaultButton(Dlg, Id, iEvent)
use XFLOGM
use DFWIN
...
i = SendMessage(Dlg%hWnd, WM_NEXTDLGCTL, 0, 0)

end subroutine

WM_NEXTDLGCTL sets the focus to the next control in tab order.

To enable Shift+Enter for reverse operation, you should test value of Shift key:

if (GetKeyState(VK_SHIFT) < 0) then
i = SendMessage(Dlg%hWnd, WM_NEXTDLGCTL, 1, 0)
else
i = SendMessage(Dlg%hWnd, WM_NEXTDLGCTL, 0, 0)
end if

Jugoslav

0 Kudos
Reply