home *** CD-ROM | disk | FTP | other *** search
/ Super Net 1 / SUPERNET_1.iso / PC / OTROS / EXTRAS / WINWAIS / VB / MAPLOC.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1993-08-30  |  6.5 KB  |  209 lines

  1. VERSION 2.00
  2. Begin Form maploc_form 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Load / Save Map Coordinates"
  6.    ClientHeight    =   1395
  7.    ClientLeft      =   1785
  8.    ClientTop       =   3135
  9.    ClientWidth     =   6075
  10.    Height          =   1800
  11.    Left            =   1725
  12.    LinkMode        =   1  'Source
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   1395
  17.    ScaleWidth      =   6075
  18.    Top             =   2790
  19.    Width           =   6195
  20.    Begin SSPanel Panel3D1 
  21.       Align           =   1  'Align Top
  22.       Alignment       =   6  'Center - TOP
  23.       BackColor       =   &H00C0C0C0&
  24.       BorderWidth     =   1
  25.       Caption         =   "Select an existing name, or enter a new name"
  26.       Font3D          =   0  'None
  27.       ForeColor       =   &H00000000&
  28.       Height          =   825
  29.       Left            =   0
  30.       Outline         =   -1  'True
  31.       RoundedCorners  =   0   'False
  32.       TabIndex        =   4
  33.       Top             =   0
  34.       Width           =   6075
  35.       Begin SSPanel Panel3D2 
  36.          Alignment       =   6  'Center - TOP
  37.          BackColor       =   &H00C0C0C0&
  38.          BevelOuter      =   1  'Inset
  39.          BorderWidth     =   1
  40.          Caption         =   "Panel3D2"
  41.          Font3D          =   1  'Raised w/light shading
  42.          ForeColor       =   &H00000000&
  43.          Height          =   435
  44.          Left            =   120
  45.          Outline         =   -1  'True
  46.          RoundedCorners  =   0   'False
  47.          TabIndex        =   5
  48.          Top             =   300
  49.          Width           =   5865
  50.          Begin ComboBox map_loc_list 
  51.             BackColor       =   &H00FFFFFF&
  52.             Height          =   300
  53.             Left            =   30
  54.             TabIndex        =   6
  55.             Top             =   60
  56.             Width           =   5775
  57.          End
  58.       End
  59.    End
  60.    Begin CommandButton map_loc_done 
  61.       Caption         =   "Done"
  62.       Height          =   375
  63.       Left            =   4290
  64.       TabIndex        =   2
  65.       Top             =   900
  66.       Width           =   975
  67.    End
  68.    Begin CommandButton map_loc_delete 
  69.       Caption         =   "Delete"
  70.       Height          =   375
  71.       Left            =   3090
  72.       TabIndex        =   3
  73.       Top             =   900
  74.       Width           =   975
  75.    End
  76.    Begin CommandButton map_loc_save 
  77.       Caption         =   "Add"
  78.       Height          =   375
  79.       Left            =   1890
  80.       TabIndex        =   1
  81.       Top             =   900
  82.       Width           =   975
  83.    End
  84.    Begin CommandButton map_loc_load 
  85.       Caption         =   "Load"
  86.       Height          =   375
  87.       Left            =   720
  88.       TabIndex        =   0
  89.       Top             =   900
  90.       Width           =   975
  91.    End
  92. Sub Form_Load ()
  93.     load_locations
  94. End Sub
  95. Sub load_locations ()
  96.     While map_loc_list.ListCount > 0
  97.       map_loc_list.RemoveItem 0
  98.     Wend
  99.     map_handle = FreeFile
  100.     On Error Resume Next
  101.     Open "wais.loc" For Input As map_handle
  102.     If Err Then
  103.       If 6 = MsgBox("'WAIS.LOC' file is missing! Create it?", MB_WARN Or 4) Then
  104.         Open "wais.loc" For Output As map_handle
  105.         Close (map_handle)
  106.         Exit Sub
  107.       Else
  108.         maploc_form.hide
  109.         Exit Sub
  110.       End If
  111.     End If
  112.     While Not EOF(map_handle)
  113.       Line Input #map_handle, map_name$
  114.       c = InStr(2, map_name$, Chr$(34))
  115.       If c > 0 Then
  116.         map_loc_list.AddItem Mid$(map_name$, 2, c - 2)
  117.       End If
  118.     Wend
  119.     Close (map_handle)
  120. End Sub
  121. Sub map_loc_delete_Click ()
  122.     If map_loc_list.ListIndex = -1 Then
  123.       MsgBox "Please select a name to be deleted", MB_INFO
  124.       Exit Sub
  125.     End If
  126.     in_map_handle = FreeFile
  127.     Open "wais.loc" For Input As in_map_handle
  128.     ot_map_handle = FreeFile
  129.     Open "wais.l$$" For Output As ot_map_handle
  130.     While Not EOF(in_map_handle)
  131.       Line Input #in_map_handle, map$
  132.       If cnt <> map_loc_list.ListIndex Then
  133.         Print #ot_map_handle, map$
  134.       Else
  135.         map_loc_list.RemoveItem cnt
  136.       End If
  137.       cnt = cnt + 1
  138.     Wend
  139.     Close (in_map_handle)
  140.     Close (ot_map_handle)
  141.     Kill "wais.loc"
  142.     Name "wais.l$$" As "wais.loc"
  143. End Sub
  144. Sub map_loc_done_Click ()
  145.     maploc_form.hide
  146. End Sub
  147. Sub map_loc_load_Click ()
  148.     If map_loc_list.ListIndex < 0 Then
  149.       MsgBox "Please select an entry from the list", MB_INFO
  150.       Exit Sub
  151.     End If
  152.     map_handle = FreeFile
  153.     Open "wais.loc" For Input As map_handle
  154.     For x = 0 To map_loc_list.ListIndex
  155.       Line Input #map_handle, map$
  156.     Next x
  157.     Close (map_handle)
  158.     p = InStr(2, map$, Chr$(34)) + 2
  159.     For c = p To Len(map$)
  160.       ch$ = Mid$(map$, c, 1)
  161.       
  162.       Select Case ch$
  163.         Case ".", "-", "+", "0" To "9"
  164.           num$ = num$ + ch$
  165.         Case ","
  166.           out_location(s1, 0) = Val(num$)
  167.           num$ = ""
  168.         Case " "
  169.           out_location(s1, 1) = Val(num$)
  170.           num$ = ""
  171.           s1 = s1 + 1
  172.         Case Else
  173.           MsgBox "Format error detected in 'WAIS.LOC' file", MB_WARN
  174.           out_point = 0
  175.           Exit Sub
  176.       End Select
  177.     Next c
  178.     out_point = s1
  179.     maploc_form.hide
  180. End Sub
  181. Sub map_loc_save_Click ()
  182.     If out_point = 0 Then
  183.       MsgBox "No coordinates are available to save", MB_INFO
  184.       Exit Sub
  185.     End If
  186.     If map_loc_list.Text = Space$(Len(map_loc_list.Text)) Then
  187.       MsgBox "Please enter a unique name for these coordinates", MB_INFO
  188.       Exit Sub
  189.     End If
  190.     For x = 0 To map_loc_list.ListCount - 1
  191.       If map_loc_list.List(x) = map_loc_list.Text Then
  192.         MsgBox "This entry already exists.  Please enter a unique name", MB_INFO
  193.         Exit Sub
  194.       End If
  195.     Next x
  196.     map_loc_list.AddItem map_loc_list.Text
  197.     map_handle = FreeFile
  198.     Open "wais.loc" For Append As map_handle
  199.     Print #map_handle, Chr$(34) + map_loc_list.Text + Chr$(34) + " ";
  200.     For x = 0 To out_point - 1
  201.       Print #map_handle, Format$(out_location(x, 0), "###.###");
  202.       Print #map_handle, ",";
  203.       Print #map_handle, Format$(out_location(x, 1), "###.###");
  204.       Print #map_handle, " ";
  205.     Next x
  206.     Print #map_handle,
  207.     Close (map_handle)
  208. End Sub
  209.