home *** CD-ROM | disk | FTP | other *** search
/ CICA 1994 September / CICA_Shareware_for_Windows_Walnut_Creek_September_1994.iso / win3 / winsock / gcp_24.exe / TERM.BA_ / TERM.BA
Text File  |  1994-03-06  |  2KB  |  90 lines

  1. Option Explicit
  2.  
  3. Global Const modal = 1
  4. Global Const modeless = 0
  5. Global Const CASCADE = 0
  6. Global Const TILE_HORIZONTAL = 1
  7. Global Const TILE_VERTICAL = 2
  8. Global Const ARRANGE_ICONS = 3
  9.  
  10. Type FormState
  11.     Deleted As Integer
  12.     Dirty As Integer
  13.     Session As String
  14. End Type
  15. Global FState()  As FormState
  16. Global Document() As New frmNotePad
  17. Global gFindString, gFindCase As Integer, gFindDirection As Integer
  18. Global gCurPos As Integer, gFirstTime As Integer
  19. Global Const IniFile = "gcp.ini"
  20. Global Const AppName = "VT-220 for Workgroups"
  21. Global Const DefaultSessionName = "Session1"
  22. Global FIndex As Integer ' global so that Notepad load can use it
  23.  
  24. Sub CenterForm (frmParent As Form, frmChild As Form)
  25. ' This procedure centers a child form over a parent form.
  26. ' Calling this routine loads the dialog. Use the Show method
  27. ' to display the dialog after calling this routine ( ie MyFrm.Show 1)
  28.  
  29. Dim l, t
  30.   ' get left offset
  31.   l = frmParent.Left + ((frmParent.Width - frmChild.Width) / 2)
  32.   If (l + frmChild.Width > screen.Width) Then
  33.     l = screen.Width = frmChild.Width
  34.   End If
  35.  
  36.   ' get top offset
  37.   t = frmParent.Top + ((frmParent.Height - frmChild.Height) / 2)
  38.   If (t + frmChild.Height > screen.Height) Then
  39.     t = screen.Height - frmChild.Height
  40.   End If
  41.  
  42.   ' center the child formfv
  43.   frmChild.Move l, t
  44.  
  45. End Sub
  46.  
  47. Function FindFreeIndex () As Integer
  48.     Dim i As Integer
  49.     Dim ArrayCount As Integer
  50.  
  51.     ArrayCount = UBound(Document)
  52.  
  53.     ' Cycle throught the document array. If one of the
  54.     ' documents has been deleted, then return that
  55.     ' index.
  56.     For i = 1 To ArrayCount
  57.         If FState(i).Deleted Then
  58.             FindFreeIndex = i
  59.             FState(i).Deleted = False
  60.             Exit Function
  61.         End If
  62.     Next
  63.  
  64.     ' If none of the elements in the document array have
  65.     ' been deleted, then increment the document and the
  66.     ' state arrays by one and return the index to the
  67.     ' new element.
  68.  
  69.     ReDim Preserve Document(ArrayCount + 1)
  70.     ReDim Preserve FState(ArrayCount + 1)
  71.     FindFreeIndex = UBound(Document)
  72. End Function
  73.  
  74. Function Sessions () As Integer
  75.     Dim i As Integer
  76.     Dim cnt As Integer
  77.  
  78.     ' Cycle throught the document array.
  79.     ' Return # documents remaining.
  80.     cnt = 0
  81.     For i = 1 To UBound(Document)
  82.         If Not FState(i).Deleted Then
  83.             cnt = cnt + 1
  84.         End If
  85.     Next
  86.     Sessions = cnt
  87.  
  88. End Function
  89.  
  90.