home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Programmer'…arterly (Limited Edition)
/
Visual_Basic_Programmers_Journal_VB-CD_Quarterly_Limited_Edition_1995.iso
/
code
/
ch19code
/
window.cls
< prev
next >
Wrap
Text File
|
1995-08-14
|
4KB
|
162 lines
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Window"
Attribute VB_Creatable = False
Attribute VB_Exposed = True
Option Explicit
Private Window As frmWindow
Public Function Create(Optional iCode) As Object
If IsMissing(iCode) Then
Windows.Add Me
' If source was within this project, don't
' delegate to Windows.Remove.
ElseIf iCode = SOURCE_INTERNAL Then
' Create window
Set Window = New frmWindow
' Keep track of the total number of windows
' ever created for Window Index property.
' Can 't use Windows.Count, since deleting
' windows yields a non-unique number.
giWindowsCount = giWindowsCount + 1
Window.Index = Str(giWindowsCount)
' Display caption.
Window.Caption = "Window" & Window.Index
' Register as the active window
Set modDeclares.gActiveWindow = Me
' Return this object as the result of Create.
Set Create = Me
' Otherwise, an invalid argument was used.
Else
' Invalid procedure call error.
Error 5
End If
End Function
' Window delete method, unloads the form.
Public Function Delete(Optional iCode)
' Check source of Delete call -- if omitted,
' delagate to Windows.Remove.
If IsMissing(iCode) Then
Windows.Remove Me
' If source was within this project, don't
' delegate to Windows.Remove.
ElseIf iCode = SOURCE_INTERNAL Then
Unload Window
' Otherwise, an invalid argument was used.
Else
' Invalid procedure call error.
Error 5
End If
End Function
#If Win16 Then
Public Property Get hWnd() As Integer
#Else
Public Property Get hWnd() As Long
#End If
hWnd = Window.hWnd
End Property
Public Property Get Name() As String
Name = Me.Caption
End Property
' Windows index property (read only).
Public Property Get Index() As String
If TypeName(Window) <> "Nothing" Then
Index = Window.Index
Else
Index = ""
End If
End Property
' Window caption property (read/write).
Public Property Let Caption(strVal As String)
Window.Caption = strVal
End Property
Public Property Get Caption() As String
Caption = Window.Caption
End Property
' Window caption property (read/write).
Public Property Let Visible(bVal As Boolean)
If bVal Then
frmWindow.Show
Else
frmWindow.Hide
End If
End Property
Public Property Get Visible() As Boolean
Visible = frmWindow.Visible
End Property
' Window height property (read/write).
Public Property Let Height(iVal As Integer)
Window.Height = iVal
End Property
Public Property Get Height() As Integer
Height = Window.Height
End Property
' Window width property (read/write).
Public Property Let Width(iVal As Integer)
Window.Width = iVal
End Property
Public Property Get Width() As Integer
Width = Window.Width
End Property
' Window top property (read/write).
Public Property Let Top(iVal As Integer)
Window.Top = iVal
End Property
Public Property Get Top() As Integer
Width = Window.Top
End Property
' Window Left property (read/write).
Public Property Let Left(iVal As Integer)
Window.Left = iVal
End Property
Public Property Get Left() As Integer
Width = Window.Left
End Property
' Window Activate method.
Public Sub Activate()
frmWindow.SetFocus
End Sub
' Window object Application property
Public Property Get Application()
Set Application = modDeclares.Application
End Property
' Selected property (read/write)
Public Property Get Selected() As Boolean
'Selected = mbSelected
End Property
Public Property Let Selected(bVal As Boolean)
'mbSelected = bVal
If bVal = True Then
' Add this object to the private Selection
' collection
'modDeclares.Selection.Add Me
' Indicate the item is selected by
' highlighting it.
' Me.BackColor = HIGHLIGHT
End If
End Property