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

Problem with overlapping dialog controls

Intel_C_Intel
Employee
850 Views
In Compaq Visual Fortran 6.6A I have a monthcalendar control that I've gotten to pop up over other controls while the user selects a date (for the code see a thread I posted earlier on this forum). After the date is selected it disappears. My problem is that I added some static text and a button now that do not get covered up when the monthcalendar control pops up messing up my calendar. Anybody know how to make sure the underlying controls don't shine through? Is there some control setting or trick in MS Visual Studio that I don't know?

Harry Bell
0 Kudos
3 Replies
Jugoslav_Dujic
Valued Contributor II
850 Views
I don't have the time at the moment to study that earlier thread; I'd suggest trying few things:

1) WS_CLIPSIBLINGS ("Clip siblings" in dialog editor) style is supposed to tell the controls not to draw themselves over their brethren controls.

2) If it does not help (drop-down lists of combo boxes, and probably monthcal's dropdown as well, tend to have special behaviour), try putting the monthcal on the top when it is about to be displayed (SetWindowPos(hwndMonth, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE+SWP_NOSIZE)).

Jugoslav
0 Kudos
Intel_C_Intel
Employee
850 Views
Thanks Juguslav! Once again you pointed the way to solving my problem. Some corrections:
1. There seems to be no "clip siblings" style in the MS Visual Studio dialog editor.
2. Confusingly, the correct command for my monthcalendar control to cover up all controls underneath it is:
ret = SetWindowPos(GetDlgItem(dlg%hWnd, IDC_MONTHCALENDAR1)
, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE+SWP_NOSIZE)

where IDC_MONTHCALENDAR1 is the name of the MONTHCALENDAR control. Note the second argument is "HWND_BOTTOM" rather than "HWND_TOP".

Harry Bell
0 Kudos
Jugoslav_Dujic
Valued Contributor II
850 Views
1) Indeed there isn't "Clip siblings" -- it is there only for dialog itself... I was so certain it was there that I didn't check :-(.

2) I agree it's confusing. I'll try to explain, although with far from 100% certainty. Tab order in the dialog is equal to:
- order of creation of controls
- order of controls in .rc file
- Z-order (order of control windows over imaginary Z-axis of the screen)
With dialogs, it seems that some of orders above are reversed. For example, I know that, if a tab control is last in .rc file/tab order, it will appear underneath the rest. However, it beats me why HWND_BOTTOM works but HWND_TOP doesn't. What happens if you simply reorder the monthcal to be first/last in tab order (Ctrl+D) or manually in .rc file (and comment out that SetWindowPos)?

Jugoslav
0 Kudos
Reply