Advertisement
2002C VB function enhancement #12412

enableFrame

When you disable a Frame then all controls in it are disabled to, nice feature, but to the users it still looks like if the controls as enabled. So I wrote a little subroutine which en/disables all controls in a frame. Can be handy sometimes :-)

AI

AIサマリー: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

ソースコード
original-source
Option Explicit
Public Sub enableFrame(curFrame As Frame)
 ' purpose:
 '  set the .enabled property of all controls on a frame to
 '  the same state as the enabled state of the current frame
 Dim ctl As Control
 
 ' Loop through all controls on the current form
 For Each ctl In curFrame.Parent.Controls
  On Error Resume Next        ' error checking, because not every control has
                    ' a container property
  If ctl.Container.hWnd = curFrame.hWnd Then
   If Err.Number = 0 Then      ' if we didn't receive an error code, proceed
    ctl.Enabled = curFrame.Enabled ' state of control same as Frame
    If TypeOf ctl Is Frame Then   ' if the control is a frame itself then
     enableFrame ctl        ' enter this procedure again for the current frame
    End If
   End If
  End If
 Next ctl
End Sub
オリジナルのコメント (3)
Wayback Machineから復元