home *** CD-ROM | disk | FTP | other *** search
/ CICA 1994 September / CICA_Shareware_for_Windows_Walnut_Creek_September_1994.iso / win3 / demo / gcp_24.exe / TERM.BA_ / TERM.BA
Text File  |  1994-04-22  |  3KB  |  101 lines

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