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

How to turn a control invisible?

davidgraham
Beginner
1,236 Views

How do I turn a dialog control invisible at runtime in an API application?

Thanks,

David

0 Kudos
5 Replies
Jugoslav_Dujic
Valued Contributor II
1,236 Views
[cpp]ShowWindow(GetDlgItem(hDlg, IDC_CONTROL), SW_SHOW)[/cpp]
0 Kudos
anthonyrichards
New Contributor III
1,236 Views
Er, SW_HIDE to hide it, SW_SHOW to display it....
0 Kudos
davidgraham
Beginner
1,236 Views

I am trying, I searched the help for 'visible', 'invisible' & 'show' but could not see anything (CVF6.6).

SW_SHOW is not mentioned in the help so I'm not sure what the parameters are.

Here I have some code to show controls 1 & 2 and hide controls 3 & 4 but it doesn't work maybe the parameters are wrong.

lret=SendMessage(hBmp(1),SW_SHOW,0,0)
lret=SendMessage(hBmp(2),SW_SHOW,0,0)
lret=SendMessage(hBmp(3),SW_HIDE,0,0)
lret=SendMessage(hBmp(4),SW_HIDE,0,0)

David

0 Kudos
anthonyrichards
New Contributor III
1,236 Views

Do you want to make a dialog control completely invisible (i.e. not draw it)?

If so, then I think you should use Jugoslav's suggestion that works ( I have tried it with an edit box in a dialog) namely:

use dfwinty ! contains parameters SW_HIDE etc.
use user32 ! contains interface blockfor ShowWindow
use dflogm ! defines types such as T_DIALOG
include 'resource.fd' ! source of control IDs such as IDC_CONTROL
type (T_DIALOG) Dlg
integer hWndDlg, hWNdControl
.....
iditem=???
if(iditem.eq.IDC_CONTROL) then
hWndDlg=Dlg%hWnd
hWndControl=GetDlgItem(hWndDlg,IDC_CONTROL)
iret=ShowWindow(hWndcontrol, SW_HIDE)
endif

To makethe window that is the control IDC_CONTROL visible, use

iret=ShowWindow(hWndcontrol, SW_SHOW)

0 Kudos
davidgraham
Beginner
1,236 Views

Thanks,

iret=ShowWindow(hWndcontrol, SW_HIDE)

and

iret=ShowWindow(hWndcontrol, SW_SHOW)

Are what are needed.

Looking back it's obvious.

Thanks,

David

0 Kudos
Reply