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

ShowWindow

jaeger0
Beginner
1,772 Views
I'm using the following lines, to show, or hide a dialog ite. For some Dialogs it works, for some not.
But no idea why. Should I use additionally a SendMessage to the item to update the drawing, or what ?

subroutine Show_Dialog_object(dlg,h_id,show)
use dflogm
use dfwinty
use user32
! input variables
TYPE (dialog) dlg ! the owner dialog
integer h_id ! object id
logical show ! TRUE.. show, FALSE.. hide

logical retlog
integer hwnd

hwnd = GetDlgItem( dlg%hwnd, h_id) ! 1341
if (show) then
retlog = ShowWindow(hwnd, SW_SHOW) ! Makes visible
else
retlog = ShowWindow(hwnd, SW_HIDE) ! Makes in-visible
endif

return
end subroutine Show_Dialog_object
0 Kudos
4 Replies
Jugoslav_Dujic
Valued Contributor II
1,772 Views
Quoting - jaeger0
I'm using the following lines, to show, or hide a dialog ite. For some Dialogs it works, for some not.
But no idea why. Should I use additionally a SendMessage to the item to update the drawing, or what ?

subroutine Show_Dialog_object(dlg,h_id,show)
hwnd = GetDlgItem( dlg%hwnd, h_id) ! 1341
if (show) then
retlog = ShowWindow(hwnd, SW_SHOW) ! Makes visible
else
retlog = ShowWindow(hwnd, SW_HIDE) ! Makes in-visible
endif

No, that will always work, as long as the dialog is alive, i.e. Dlg%hwnd is a valid handle. That will be the case only after (or during) DlgModal or DlgModeless, but not before. If you need initialization, write a DLG_INIT callback and call this from there.
0 Kudos
jaeger0
Beginner
1,772 Views
Quoting - Jugoslav Dujic

No, that will always work, as long as the dialog is alive, i.e. Dlg%hwnd is a valid handle. That will be the case only after (or during) DlgModal or DlgModeless, but not before. If you need initialization, write a DLG_INIT callback and call this from there.

ok, the Dialog is initialized, and I call the show_Dialog_oobject during an update routine.
I found out GetDlgItem returns 0 for hwnd, this may be the reason. Is there another way to get hwnd ?
0 Kudos
jaeger0
Beginner
1,772 Views
Quoting - jaeger0

ok, the Dialog is initialized, and I call the show_Dialog_oobject during an update routine.
I found out GetDlgItem returns 0 for hwnd, this may be the reason. Is there another way to get hwnd ?
Now I found out, that the problem comes by using the XFLOGM instead IFLOGM,
I use this module only for one Dialog, and the IFLOGM for the remaining, maybe this molules are making problems, if I use both
0 Kudos
Jugoslav_Dujic
Valued Contributor II
1,772 Views
Quoting - jaeger0
Now I found out, that the problem comes by using the XFLOGM instead IFLOGM,
I use this module only for one Dialog, and the IFLOGM for the remaining, maybe this molules are making problems, if I use both

Yes, mixing them is problematic at best. You may mix them, I guess (never tried), but you have to be careful that they're used both for its own set of dialogs.
0 Kudos
Reply