cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Kobbler
Level 3

Hiding labels

Hi,
I have a simple question. I am making a custom dialog. I want to disable a label on the screen and then enable it later depending on the value of a variable. Could someone please show me how to do this. I thought I had it but for some reason it won't work.

The label will be disabled (made invisible) upon entering the dialog. It will then be enabled if the variable SHOWDIALOG is set to true.

Thanks in advance,
Kevin
Labels (1)
0 Kudos
(3) Replies
TheTraveler
Level 8

Hello,

Try this...

prototype My_ControlVisible(BYVAL number, BYVAL number, BYVAL BOOL);

function My_ControlVisible(hDlg, nControlID, bState)
number hCtrl;
begin
hCtrl = GetDlgItem(hDlg, nControlID);
if bState then
ShowWindow(hCtrl, SW_SHOW);
else
ShowWindow(hCtrl, SW_HIDE);
endif;
end;


Explanation:

The hDlg is the handle of the custom dialog. The nCotrolID should be the ID number of the label you want to be visible or invisible. Of coarse, the bState is a TRUE/FALSE value that will decide to hide it or not.
0 Kudos
RobertDickau
Flexera Alumni

I think the ISMP control classes support a setVisible method with which you can hide or show controls; searching these forums for "setVisible" will turn up some examples.
0 Kudos
Kobbler
Level 3

It worked. Thank you.
0 Kudos