Software Archive
Read-only legacy content
17061 Discussions

Can you turn a control invisible by code?

davidgraham
Beginner
476 Views
There is a flag when designing a dialog box to turn a control invisible.

But is there a way to do it in the code?

There is the call Enable Window that can grey is out a control, but I want it to be completely invisible in some circumstances and visible in others.

There is WS_VISIBLE but don't know if it is what I should use, or how to use it.

Thanks,

David
0 Kudos
4 Replies
wkramer
Beginner
476 Views
Just a check to see if the forum still works. I tried to send an old forum discussion on the subject.
0 Kudos
wkramer
Beginner
476 Views
Here a part of an old forum discussion. Long messages don't seem to be allowed


Jeffrey S. Pidel
I am using DVF 5.0c and want to make a dialog control (check box)
invisible for some users and visible for other users. I know how to
disable it but I don't see any option except in the dialog editor to
make it invisible.
Thanks for the help!


Hi,
It's easy in standard Windows' applications with using Win32 API functions. Let's suppose that
your control has identifier IDC_SOMETHING.
Thus, the line below
iret = ShowWindow(GetDlgItem(hDlg,IDC_SOMETHING),SW_HIDE)
will make your control invisible.
and the line
iret = ShowWindow(GetDlgItem(hDlg,IDC_SOMETHING),SW_SHOWNORMAL)
will make your control visible again.
If you write standard Windows application ( not Dialog), try to insert one of these lines into
WM_INITDIALOG section of the dialog procedure and test program with various initial states of
your control from dialog editor you used.

hDlg - the parameter ( dialog handle ) of your dialog procedure.

Hope this helps,
Vladimir V.Vasilchenko
Rostov State University
Mechanics and Applied Mathematics Research Institute
Russia
0 Kudos
wkramer
Beginner
476 Views
Hi, here is a discussion on the subject from the old forum:





Topic: Fortran Message #1801

Subject: Control Visibility of Bitmap in Dialog

From: alioth 11/08/99 19:26:19


Using the dialog editor of Visual Fortran, a bitmap image can be included in a dialog with the
static picture control. One of the properties that can be set when the control is defined in the
dialog editor is "visible". How can a message be sent to the control during run time to alter
this property? For example, if the property is initially not checked, the picture is invisible.
How can the the picture be made visible at some point during run time? Can the
DlgSendCtrlMessage() function be used to do this, and if so, what are the required arguments?

Topic: Fortran Message #1808

Subject: RE: Control Visibility of Bitmap in Dialog

From: alioth 11/09/99 16:55:19


Hi,
I have found a method that seems allow control of the visibility of a bitmap in a dialog box.

Assume dlg is the dialog containing a picture , IDC_STATIC_BITMAP_1, and the visible box in the
properties list is unchecked (the control is initially invisible). Also assume dlg is currently
displayed.

The following code will cause the picture control to be visible when executed. Modules dflogm,
dfwinty, and user32 are required.
 
use dflogm  
use dfwinty  
use user32  
.  
.  
.  
type(dialog) :: dlg  
integer :: hwnd  
logical :: retlog  
.  
.  
.  
hwnd = GetDlgItem( dlg%hwnd, IDC_STATIC_BITMAP_1)  
retlog = ShowWindow(hwnd, SW_SHOW) ! Makes visible  
.  
.  
.  
retlog = ShowWindow(hwnd, SW_HIDE) ! Makes invisible  


If anyone has a better solution, I would be interested.

Thanks,
Alioth

Subject: Re: DVF dialog control invisible
Date: 08/12/1999
Author: Vladimir V.Vasilchenko



Jeffrey S. Pidel ...
> I am using DVF 5.0c and want to make a dialog control (check box)
> invisible for some users and visible for other users. I know how to
> disable it but I don't see any option except in the dialog editor to
> make it invisible.
> Thanks for the help!
Hi,
It's easy in standard Windows' applications with using Win32 API functions. Let's suppose that
your control has identifier IDC_SOMETHING.
Thus, the line below

iret = ShowWindow(GetDlgItem(hDlg,IDC_SOMETHING),SW_HIDE)

will make your control invisible.
and the line

iret = ShowWindow(GetDlgItem(hDlg,IDC_SOMETHING),SW_SHOWNORMAL)

will make your control visible again.
If you write standard Windows application ( not Dialog), try to insert one of these lines into
WM_INITDIALOG section of the dialog procedure and test program with various initial states of
your control from dialog editor you used.

hDlg - the parameter ( dialog handle ) of your dialog procedure.

Hope this helps,
Vladimir V.Vasilchenko
Rostov State University
Mechanics and Applied Mathematics Research Institute
Russia
http://www.gis.rnd.runnet.ru/team/clubs/FClub.html

Topic: Fortran Message #3805

Subject: Visibility on Dynamic Dialog

From: teshmont 05/24/00 14:19:02


My application program I'm porting from a DOS console version keeps providing users with a menu
of options to choose from.

Sometimes there are only two options, and sometimes there can be up to seven.

I want to display (have visible) only the options that are valid. I can disable the unnecessary
options, but what I really want to do is to make the ones I don't need invisible.

dlg_visible doesn't work as a parameter to DLGSET.
Does anyone know the syntax?

Thanks in advance,

David Rivers
Computer System Analyst
Teshmont Consultants
Winnipeg Canada

Topic: Fortran Me
0 Kudos
wkramer
Beginner
476 Views
Oke, it seems to work so here a retry.

The old forum discussions:


Had to strip the discussion. Long messages don't seem to be allowed


Subject: Re: DVF dialog control invisible
Date: 08/12/1999
Author: Vladimir V.Vasilchenko

Jeffrey S. Pidel
<37B305FA.A2768750@bellsouth.net>...
I am using DVF 5.0c and want to make a dialog control (check box)
invisible for some users and visible for other users. I know how to
disable it but I don't see any option except in the dialog editor to
make it invisible.
Thanks for the help!


Hi,
It's easy in standard Windows' applications with using Win32 API functions. Let's suppose that
your control has identifier IDC_SOMETHING.
Thus, the line below
iret = ShowWindow(GetDlgItem(hDlg,IDC_SOMETHING),SW_HIDE)
will make your control invisible.
and the line
iret = ShowWindow(GetDlgItem(hDlg,IDC_SOMETHING),SW_SHOWNORMAL)
will make your control visible again.
If you write standard Windows application ( not Dialog), try to insert one of these lines into
WM_INITDIALOG section of the dialog procedure and test program with various initial states of
your control from dialog editor you used.

hDlg - the parameter ( dialog handle ) of your dialog procedure.

Hope this helps,
Vladimir V.Vasilchenko
Rostov State University
Mechanics and Applied Mathematics Research Institute
Russia
0 Kudos
Reply