home *** CD-ROM | disk | FTP | other *** search
/ Master 95 #1 / MASTER95_1.iso / microsof / vbasic4 / vb4-6.cab / ui.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-07-26  |  19.8 KB  |  567 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Soccer League"
  5.    ClientHeight    =   5928
  6.    ClientLeft      =   1920
  7.    ClientTop       =   1920
  8.    ClientWidth     =   8892
  9.    Height          =   6348
  10.    Left            =   1872
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   5928
  13.    ScaleWidth      =   8892
  14.    Top             =   1548
  15.    Width           =   8988
  16.    Begin VB.CommandButton btnClear 
  17.       Caption         =   "Clear"
  18.       Height          =   375
  19.       Left            =   7200
  20.       TabIndex        =   33
  21.       Top             =   5040
  22.       Width           =   1335
  23.    End
  24.    Begin VB.CommandButton btnLoad 
  25.       Caption         =   "Load"
  26.       Height          =   375
  27.       Left            =   5760
  28.       TabIndex        =   32
  29.       Top             =   5040
  30.       Width           =   1335
  31.    End
  32.    Begin VB.CommandButton btnSave 
  33.       Caption         =   "Save"
  34.       Height          =   390
  35.       Left            =   4440
  36.       TabIndex        =   31
  37.       Top             =   5052
  38.       Width           =   1215
  39.    End
  40.    Begin VB.ComboBox listPlayerName 
  41.       Height          =   288
  42.       Left            =   4440
  43.       Style           =   2  'Dropdown List
  44.       TabIndex        =   23
  45.       Top             =   2640
  46.       Width           =   2364
  47.    End
  48.    Begin VB.CommandButton buttonAddPlayer 
  49.       Caption         =   "Add"
  50.       Height          =   375
  51.       Left            =   6960
  52.       TabIndex        =   22
  53.       Top             =   2640
  54.       Width           =   855
  55.    End
  56.    Begin VB.CommandButton buttonRemovePlayer 
  57.       Caption         =   "Remove"
  58.       Height          =   375
  59.       Left            =   7920
  60.       TabIndex        =   21
  61.       Top             =   2640
  62.       Width           =   855
  63.    End
  64.    Begin VB.ComboBox listPlayerTeam 
  65.       Height          =   288
  66.       Left            =   4440
  67.       Style           =   2  'Dropdown List
  68.       TabIndex        =   20
  69.       Top             =   3240
  70.       Width           =   2364
  71.    End
  72.    Begin VB.ComboBox listPlayerPosition 
  73.       Height          =   288
  74.       Left            =   4440
  75.       Style           =   2  'Dropdown List
  76.       TabIndex        =   19
  77.       Top             =   3960
  78.       Width           =   2364
  79.    End
  80.    Begin VB.CommandButton buttonAddTeam 
  81.       Caption         =   "Add"
  82.       Height          =   372
  83.       Left            =   6960
  84.       TabIndex        =   7
  85.       Top             =   1080
  86.       Width           =   1800
  87.    End
  88.    Begin VB.PictureBox Picture1 
  89.       BackColor       =   &H00000000&
  90.       Height          =   5376
  91.       Left            =   240
  92.       ScaleHeight     =   5352
  93.       ScaleWidth      =   3720
  94.       TabIndex        =   2
  95.       Top             =   252
  96.       Width           =   3744
  97.       Begin VB.PictureBox Picture2 
  98.          BackColor       =   &H00C0C0C0&
  99.          Height          =   5016
  100.          Left            =   204
  101.          ScaleHeight     =   4992
  102.          ScaleWidth      =   3252
  103.          TabIndex        =   3
  104.          Top             =   156
  105.          Width           =   3276
  106.          Begin VB.Label LabelStriker 
  107.             AutoSize        =   -1  'True
  108.             BackColor       =   &H00C0C0C0&
  109.             BackStyle       =   0  'Transparent
  110.             Caption         =   "Striker"
  111.             Height          =   252
  112.             Left            =   1320
  113.             TabIndex        =   18
  114.             Top             =   4680
  115.             Width           =   492
  116.          End
  117.          Begin VB.Label LabelRightFullback 
  118.             AutoSize        =   -1  'True
  119.             BackColor       =   &H00C0C0C0&
  120.             BackStyle       =   0  'Transparent
  121.             Caption         =   "Right Fullback"
  122.             Height          =   195
  123.             Left            =   2040
  124.             TabIndex        =   17
  125.             Top             =   1200
  126.             Width           =   1260
  127.          End
  128.          Begin VB.Label LabelSweeper 
  129.             AutoSize        =   -1  'True
  130.             BackColor       =   &H00C0C0C0&
  131.             BackStyle       =   0  'Transparent
  132.             Caption         =   "Sweeper"
  133.             Height          =   195
  134.             Left            =   1200
  135.             TabIndex        =   16
  136.             Top             =   720
  137.             Width           =   645
  138.          End
  139.          Begin VB.Label LabelLeftFullback 
  140.             AutoSize        =   -1  'True
  141.             BackColor       =   &H00C0C0C0&
  142.             BackStyle       =   0  'Transparent
  143.             Caption         =   "Left Fullback"
  144.             Height          =   195
  145.             Left            =   240
  146.             TabIndex        =   15
  147.             Top             =   1200
  148.             Width           =   1335
  149.          End
  150.          Begin VB.Label LabelRightWing 
  151.             AutoSize        =   -1  'True
  152.             BackColor       =   &H00C0C0C0&
  153.             BackStyle       =   0  'Transparent
  154.             Caption         =   "Right Wing"
  155.             Height          =   195
  156.             Left            =   2040
  157.             TabIndex        =   14
  158.             Top             =   2160
  159.             Width           =   1095
  160.          End
  161.          Begin VB.Label LabelCenterMidfielder 
  162.             BackColor       =   &H00C0C0C0&
  163.             BackStyle       =   0  'Transparent
  164.             Caption         =   "Center Midfielder"
  165.             Height          =   252
  166.             Left            =   960
  167.             TabIndex        =   13
  168.             Top             =   2880
  169.             Width           =   1332
  170.          End
  171.          Begin VB.Label LabelLeftWing 
  172.             AutoSize        =   -1  'True
  173.             BackColor       =   &H00C0C0C0&
  174.             BackStyle       =   0  'Transparent
  175.             Caption         =   "Left Wing"
  176.             Height          =   195
  177.             Left            =   240
  178.             TabIndex        =   12
  179.             Top             =   2160
  180.             Width           =   1215
  181.          End
  182.          Begin VB.Label labelRightForward 
  183.             AutoSize        =   -1  'True
  184.             BackColor       =   &H00C0C0C0&
  185.             BackStyle       =   0  'Transparent
  186.             Caption         =   "Right Forward"
  187.             Height          =   192
  188.             Left            =   2040
  189.             TabIndex        =   11
  190.             Top             =   3960
  191.             Width           =   996
  192.          End
  193.          Begin VB.Label LabelLeftForward 
  194.             AutoSize        =   -1  'True
  195.             BackColor       =   &H00C0C0C0&
  196.             BackStyle       =   0  'Transparent
  197.             Caption         =   "Left Forward"
  198.             Height          =   192
  199.             Left            =   240
  200.             TabIndex        =   10
  201.             Top             =   3960
  202.             Width           =   876
  203.          End
  204.          Begin VB.Label LabelCenter 
  205.             AutoSize        =   -1  'True
  206.             BackColor       =   &H00C0C0C0&
  207.             BackStyle       =   0  'Transparent
  208.             Caption         =   "Center"
  209.             Height          =   192
  210.             Left            =   1320
  211.             TabIndex        =   9
  212.             Top             =   4080
  213.             Width           =   468
  214.          End
  215.          Begin VB.Label LabelGoalie 
  216.             AutoSize        =   -1  'True
  217.             BackColor       =   &H00C0C0C0&
  218.             BackStyle       =   0  'Transparent
  219.             Caption         =   "Goalie"
  220.             Height          =   195
  221.             Left            =   1320
  222.             TabIndex        =   8
  223.             Top             =   240
  224.             Width           =   480
  225.          End
  226.          Begin VB.Shape Shape4 
  227.             Height          =   975
  228.             Left            =   960
  229.             Shape           =   3  'Circle
  230.             Top             =   3840
  231.             Width           =   1095
  232.          End
  233.          Begin VB.Shape Shape3 
  234.             Height          =   4812
  235.             Left            =   120
  236.             Top             =   120
  237.             Width           =   3012
  238.          End
  239.          Begin VB.Shape Shape2 
  240.             Height          =   855
  241.             Left            =   840
  242.             Top             =   120
  243.             Width           =   1575
  244.          End
  245.          Begin VB.Shape Shape1 
  246.             Height          =   495
  247.             Left            =   1080
  248.             Top             =   120
  249.             Width           =   1095
  250.          End
  251.       End
  252.    End
  253.    Begin VB.ComboBox listTeams 
  254.       Height          =   288
  255.       Left            =   4440
  256.       Style           =   2  'Dropdown List
  257.       TabIndex        =   1
  258.       Top             =   1080
  259.       Width           =   2364
  260.    End
  261.    Begin VB.Label lblLeague 
  262.       AutoSize        =   -1  'True
  263.       BackColor       =   &H00C0C0C0&
  264.       Caption         =   "League:"
  265.       BeginProperty Font 
  266.          name            =   "MS Sans Serif"
  267.          charset         =   1
  268.          weight          =   700
  269.          size            =   12
  270.          underline       =   0   'False
  271.          italic          =   0   'False
  272.          strikethrough   =   0   'False
  273.       EndProperty
  274.       Height          =   300
  275.       Left            =   4440
  276.       TabIndex        =   30
  277.       Top             =   4644
  278.       Width           =   960
  279.    End
  280.    Begin VB.Line Line1 
  281.       X1              =   4440
  282.       X2              =   8508
  283.       Y1              =   4524
  284.       Y2              =   4524
  285.    End
  286.    Begin VB.Label lblPlayers 
  287.       AutoSize        =   -1  'True
  288.       BackColor       =   &H00C0C0C0&
  289.       Caption         =   "Players:"
  290.       BeginProperty Font 
  291.          name            =   "MS Sans Serif"
  292.          charset         =   1
  293.          weight          =   700
  294.          size            =   12
  295.          underline       =   0   'False
  296.          italic          =   0   'False
  297.          strikethrough   =   0   'False
  298.       EndProperty
  299.       Height          =   348
  300.       Left            =   4440
  301.       TabIndex        =   29
  302.       Top             =   1920
  303.       Width           =   1140
  304.    End
  305.    Begin VB.Label lblTeam 
  306.       AutoSize        =   -1  'True
  307.       BackColor       =   &H00C0C0C0&
  308.       Caption         =   "Teams:"
  309.       BeginProperty Font 
  310.          name            =   "MS Sans Serif"
  311.          charset         =   1
  312.          weight          =   700
  313.          size            =   12
  314.          underline       =   0   'False
  315.          italic          =   0   'False
  316.          strikethrough   =   0   'False
  317.       EndProperty
  318.       Height          =   348
  319.       Left            =   4440
  320.       TabIndex        =   28
  321.       Top             =   360
  322.       Width           =   1056
  323.    End
  324.    Begin VB.Label capPlayerName 
  325.       AutoSize        =   -1  'True
  326.       BackColor       =   &H00C0C0C0&
  327.       Caption         =   "Total Number of Players:"
  328.       Height          =   192
  329.       Left            =   4440
  330.       TabIndex        =   27
  331.       Top             =   2400
  332.       Width           =   1776
  333.    End
  334.    Begin VB.Label Label3 
  335.       BackColor       =   &H00C0C0C0&
  336.       Caption         =   "Team:"
  337.       Height          =   252
  338.       Left            =   4440
  339.       TabIndex        =   26
  340.       Top             =   3000
  341.       Width           =   1452
  342.    End
  343.    Begin VB.Label Label4 
  344.       BackColor       =   &H00C0C0C0&
  345.       Caption         =   "Position:"
  346.       Height          =   252
  347.       Left            =   4440
  348.       TabIndex        =   25
  349.       Top             =   3720
  350.       Width           =   1452
  351.    End
  352.    Begin VB.Label labelNumberPlayers 
  353.       BackColor       =   &H00C0C0C0&
  354.       Caption         =   "0"
  355.       Height          =   252
  356.       Left            =   6360
  357.       TabIndex        =   24
  358.       Top             =   2400
  359.       Width           =   480
  360.    End
  361.    Begin VB.Line IvoWilliamSalmre 
  362.       X1              =   4200
  363.       X2              =   4200
  364.       Y1              =   240
  365.       Y2              =   5640
  366.    End
  367.    Begin VB.Label labelPlayersOnTeam 
  368.       BackColor       =   &H00C0C0C0&
  369.       Caption         =   "0"
  370.       Height          =   252
  371.       Left            =   5760
  372.       TabIndex        =   6
  373.       Top             =   1560
  374.       Width           =   348
  375.    End
  376.    Begin VB.Label Label2 
  377.       BackColor       =   &H00C0C0C0&
  378.       Caption         =   "Players on Team:"
  379.       Height          =   240
  380.       Left            =   4440
  381.       TabIndex        =   5
  382.       Top             =   1560
  383.       Width           =   1344
  384.    End
  385.    Begin VB.Label Label1 
  386.       BackColor       =   &H00C0C0C0&
  387.       Caption         =   "Number of Teams:"
  388.       Height          =   240
  389.       Left            =   4440
  390.       TabIndex        =   4
  391.       Top             =   840
  392.       Width           =   1344
  393.    End
  394.    Begin VB.Label labelNumberTeams 
  395.       BackColor       =   &H00C0C0C0&
  396.       Caption         =   "0"
  397.       Height          =   252
  398.       Left            =   5880
  399.       TabIndex        =   0
  400.       Top             =   840
  401.       Width           =   348
  402.    End
  403. Attribute VB_Name = "Form1"
  404. Attribute VB_Creatable = False
  405. Attribute VB_Exposed = False
  406. Private Sub btnClear_Click()
  407.     If (MsgBox("Delete all the teams and players in the league", vbOKCancel) = vbOK) Then
  408.         gServerApp.ClearLeague
  409.     End If
  410.     fillTeamsList
  411.     fillPlayersList
  412. End Sub
  413. Private Sub btnLoad_Click()
  414.     Dim Response
  415.     Const MB_IDCANCEL = 3
  416.     Response = InputBox("If a file containing player and team information is available, enter the file's name:")
  417.     If Response = IDCANCEL Then
  418.         Exit Sub
  419.     Else
  420.         gServerApp.Load Response
  421.         fillTeamsList
  422.         fillPlayersList
  423.     End If
  424. End Sub
  425. Private Sub btnSave_Click()
  426.     Dim Response
  427.     Const MB_IDCANCEL = 3
  428.     Response = InputBox("Enter file name:")
  429.     If Response = IDCANCEL Then
  430.         Exit Sub
  431.     Else
  432.         gServerApp.Save Response
  433.     End If
  434. End Sub
  435. Private Sub Form_Load()
  436.     GetAppRef
  437.     fillTeamsList
  438.     fillPoitionsList
  439.     fillPlayersList
  440.     MsgBox "To create players and teams, first add one or more teams." & Chr$(10) & "Then add players, and for each player select a team and position.", 64, "Soccer/Client"
  441. End Sub
  442. Private Sub buttonAddPlayer_Click()
  443.     Dim player
  444.     Set player = gServerApp.Players.Add(InputBox("Enter the name of the new player." & Chr(10) & "Click OK, then select a team and position for the player"))
  445.     On Error Resume Next
  446.     If (Not (player Is Nothing)) Then
  447.         Dim team As Object
  448.         ' Put the new player on the 'NO TEAM' team.
  449.         Set team = gServerApp.Teams.Item("NO TEAM")
  450.         team.addplayer player
  451.         
  452.         ' Set the position to NO POSITION.
  453.         player.position = "NO POSITION"
  454.         
  455.         ' Update the list.
  456.         fillPlayersList
  457.         
  458.         ' Select the player's name from the combo box.
  459.         Form1.listPlayerName.Text = player.Name
  460.     End If
  461. End Sub
  462. Private Sub buttonAddTeam_Click()
  463. Dim newTeamName As String
  464.     ' Get the team's name from an input box and add the team.
  465.     newTeamName = InputBox("Enter Name of new team:")
  466.     gServerApp.Teams.Add newTeamName
  467.     ' Add it to the Teams list.
  468.     Form1.listTeams.AddItem newTeamName
  469.     ' Add it to the player's team list.
  470.     Form1.listPlayerTeam.AddItem newTeamName
  471.         
  472.     ' Update the number of teams.
  473.     Form1.labelNumberTeams.Caption = gServerApp.Teams.Count - 1
  474. End Sub
  475. Private Sub buttonRemovePlayer_Click()
  476.     gServerApp.Players.Remove listPlayerName.Text
  477.     ' Update the list.
  478.     fillPlayersList
  479.     ' Reset the visual field representation.
  480.     listTeams_Click
  481. End Sub
  482. Private Sub buttonRemoveTeam_Click()
  483.     gServerApp.Teams.Remove listTeams.Text
  484.     ' Update the list.
  485.     fillTeamsList
  486.     ' Update the existing player (the player's team may have been deleted).
  487.     listPlayerName_Click
  488. End Sub
  489. ' Handle the user selecting a new player from the player list.
  490. Private Sub listPlayerName_Click()
  491.     ' Add the new player's position to the Position list.
  492.     ' Note: this will implicitly call listPlayerPosition_Click.
  493.     Form1!listPlayerPosition.Text = _
  494.             gServerApp.Players.Item(Form1!listPlayerName.Text).position
  495.     ' Add the player's team name to the team list.
  496.     ' Note: this will implicitly call listPlayerTeam_Click.
  497.     Form1!listPlayerTeam.Text = gServerApp.Players.Item(Form1!listPlayerName.Text).team.Name
  498. End Sub
  499. ' Change the player's position.
  500. Private Sub listPlayerPosition_Click()
  501. Dim player
  502.     ' Only do something if there's a player.
  503.     If (Form1.listPlayerName <> "") Then
  504.         
  505.         Set player = gServerApp.Players.Item(Form1!listPlayerName.Text)
  506.         ' Change the current player's position to match what was
  507.         ' selected in the list box.
  508.         player.position = Form1!listPlayerPosition.Text
  509.         
  510.         ' Update the field positions.
  511.         If (UCase(player.team.Name) = UCase(Form1.listTeams)) Then
  512.             listTeams_Click
  513.         End If
  514.     End If
  515. End Sub
  516. ' Change the current player's team affiliation.
  517. Private Sub listPlayerTeam_Click()
  518.     Dim player
  519.     Dim team
  520.     ' Only do something if there's a player.
  521.     If (Form1.listPlayerName <> "") Then
  522.         Set player = gServerApp.Players.Item(Form1!listPlayerName.Text)
  523.         
  524.         ' Add the current player to the team just selected in this box.
  525.         Set team = gServerApp.Teams.Item(Form1!listPlayerTeam.Text)
  526.         team.addplayer player
  527.         ' Update the field positions.
  528.         If (UCase(player.team.Name) = UCase(Form1.listTeams)) Then
  529.             listTeams_Click
  530.         End If
  531.     End If
  532. End Sub
  533. Private Sub listTeams_Click()
  534.     Dim newTeam As Object
  535.     Dim aplayer As Object
  536.     Dim loop1
  537.     Dim players_on_Team
  538.     ResetPositionNames
  539.     ' Get the Team object corresponding to the current team.
  540.     Set newTeam = gServerApp.Teams.Item(Form1.listTeams.Text)
  541.     ' Iterate through all the players and see which ones are on this team.
  542.     players_on_Team = 0
  543.     For loop1 = 1 To gServerApp.Players.Count
  544.         ' Get a player.
  545.         Set aplayer = gServerApp.Players.Item(loop1)
  546.         ' Check to see if the player is on this team.
  547.         If (aplayer.team Is newTeam) Then
  548.             ' Update the counter.
  549.             players_on_Team = players_on_Team + 1
  550.             ' If the player is assigned a position, add the player's name to the field.
  551.             If (UCase(aplayer.position) = "GOALIE") Then Form1.LabelGoalie.Caption = aplayer.Name
  552.             If (UCase(aplayer.position) = "CENTER") Then Form1.LabelCenter.Caption = aplayer.Name
  553.             If (UCase(aplayer.position) = "RIGHT FORWARD") Then Form1.labelRightForward.Caption = aplayer.Name
  554.             If (UCase(aplayer.position) = "LEFT FORWARD") Then Form1.LabelLeftForward.Caption = aplayer.Name
  555.             If (UCase(aplayer.position) = "LEFT WING") Then Form1.LabelLeftWing.Caption = aplayer.Name
  556.             If (UCase(aplayer.position) = "CENTER MIDFIELDER") Then Form1.LabelCenterMidfielder.Caption = aplayer.Name
  557.             If (UCase(aplayer.position) = "RIGHT WING") Then Form1.labelRightWing.Caption = aplayer.Name
  558.             If (UCase(aplayer.position) = "LEFT FULLBACK") Then Form1.LabelLeftFullback.Caption = aplayer.Name
  559.             If (UCase(aplayer.position) = "SWEEPER") Then Form1.LabelSweeper.Caption = aplayer.Name
  560.             If (UCase(aplayer.position) = "RIGHT FULLBACK") Then Form1.LabelRightFullback.Caption = aplayer.Name
  561.             If (UCase(aplayer.position) = "STRIKER") Then Form1.LabelStriker.Caption = aplayer.Name
  562.         End If
  563.     Next
  564.     ' Update the number of players on the team.
  565.     Form1.labelPlayersOnTeam.Caption = Trim(Str(players_on_Team))
  566. End Sub
  567.