Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Greying-out contents of frames

Status
Not open for further replies.

Nojj

Computer
Apr 8, 2003
10
When you disable a frame by setting its enable property to false, the contents of the frame are disabled but not greyed out. Is there a way to grey them out without writing code to individually enable/disable every control in the frame?

 
Replies continue below

Recommended for you

As far as I know, you have to disable each control individually. However, that can be done quite easily by a separate subroutine which accepts a parent control id, and then loops through the controls collection, and processing only those controls whose parent is the passed in frame. Specific syntax will depend on what language you're using.
 
Thanks CajunCenturion. That sounds like a great idea. I'll give it a try.
 
One thing that you need to be careful of. If you have a frame inside of another frame, and you disable to outer frame, you will have a multi-level issue to deal with as the controls in the inner frame will have the inner frame as it's container, and not the outer frame.

As long as you don't have container objects inside of the outer frame, you don't need to worry about it.
 
Here's the code I tried which works OK for most controls but it fails when I put a SysInfo control on the form. Why?

Dim objCtl As Object
For Each objCtl In Controls
If objCtl.Container.Name = MyFrame Then
objCtl.Enabled = False
End If
Next
 
The SysInfo control has is a special purpose control and may not have an enabled property.

There are two ways to deal with this. One way is to take the SysInfo control outside of the frame so that its containiner is the form. Second, you could use the on error resume next statement, to ignore the error.
 
The error occurs if the SysInfo control is inside or outside the frame. I added this line to avoid it.

If TypeOf objCtl Is SysInfo Then
.
.

Everything works fine now. Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor