home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD41653232000.psc / frmProperties.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2000-03-17  |  8.8 KB  |  284 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Begin VB.Form frmProperties 
  4.    BorderStyle     =   4  'Fixed ToolWindow
  5.    Caption         =   "Properties"
  6.    ClientHeight    =   2880
  7.    ClientLeft      =   45
  8.    ClientTop       =   285
  9.    ClientWidth     =   3135
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   2880
  14.    ScaleWidth      =   3135
  15.    ShowInTaskbar   =   0   'False
  16.    StartUpPosition =   3  'Windows Default
  17.    Begin VB.TextBox txtIP 
  18.       Appearance      =   0  'Flat
  19.       BackColor       =   &H8000000F&
  20.       Height          =   375
  21.       Left            =   1320
  22.       Locked          =   -1  'True
  23.       TabIndex        =   9
  24.       TabStop         =   0   'False
  25.       Top             =   1080
  26.       Width           =   1695
  27.    End
  28.    Begin VB.TextBox txtComputerName 
  29.       Appearance      =   0  'Flat
  30.       BackColor       =   &H8000000F&
  31.       Height          =   375
  32.       Left            =   1320
  33.       Locked          =   -1  'True
  34.       TabIndex        =   8
  35.       TabStop         =   0   'False
  36.       Top             =   600
  37.       Width           =   1695
  38.    End
  39.    Begin VB.TextBox txtNetworkID 
  40.       Appearance      =   0  'Flat
  41.       BackColor       =   &H8000000F&
  42.       Height          =   375
  43.       Left            =   1320
  44.       Locked          =   -1  'True
  45.       TabIndex        =   7
  46.       TabStop         =   0   'False
  47.       Top             =   120
  48.       Width           =   1695
  49.    End
  50.    Begin VB.TextBox txtName 
  51.       Appearance      =   0  'Flat
  52.       Height          =   375
  53.       Left            =   1320
  54.       MaxLength       =   20
  55.       TabIndex        =   1
  56.       Top             =   1560
  57.       Width           =   1695
  58.    End
  59.    Begin VB.TextBox txtUDPPort 
  60.       Appearance      =   0  'Flat
  61.       Height          =   375
  62.       Left            =   1320
  63.       MaxLength       =   4
  64.       TabIndex        =   3
  65.       Top             =   2040
  66.       Width           =   1695
  67.    End
  68.    Begin MSComctlLib.ImageList imgHot 
  69.       Left            =   4320
  70.       Top             =   1200
  71.       _ExtentX        =   1005
  72.       _ExtentY        =   1005
  73.       BackColor       =   -2147483643
  74.       ImageWidth      =   16
  75.       ImageHeight     =   16
  76.       MaskColor       =   16711935
  77.       _Version        =   393216
  78.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  79.          NumListImages   =   2
  80.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  81.             Picture         =   "frmProperties.frx":0000
  82.             Key             =   ""
  83.          EndProperty
  84.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  85.             Picture         =   "frmProperties.frx":0354
  86.             Key             =   ""
  87.          EndProperty
  88.       EndProperty
  89.    End
  90.    Begin MSComctlLib.ImageList imgNorm 
  91.       Left            =   3720
  92.       Top             =   1200
  93.       _ExtentX        =   1005
  94.       _ExtentY        =   1005
  95.       BackColor       =   -2147483643
  96.       ImageWidth      =   16
  97.       ImageHeight     =   16
  98.       MaskColor       =   16711935
  99.       _Version        =   393216
  100.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  101.          NumListImages   =   2
  102.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  103.             Picture         =   "frmProperties.frx":06A8
  104.             Key             =   ""
  105.          EndProperty
  106.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  107.             Picture         =   "frmProperties.frx":09FC
  108.             Key             =   ""
  109.          EndProperty
  110.       EndProperty
  111.    End
  112.    Begin VB.CommandButton cmdOK 
  113.       Caption         =   "&OK"
  114.       Default         =   -1  'True
  115.       Height          =   350
  116.       Left            =   3840
  117.       TabIndex        =   4
  118.       TabStop         =   0   'False
  119.       Top             =   1800
  120.       Width           =   975
  121.    End
  122.    Begin VB.CommandButton cmdCancel 
  123.       Cancel          =   -1  'True
  124.       Caption         =   "&Cancel"
  125.       Height          =   350
  126.       Left            =   3840
  127.       TabIndex        =   5
  128.       TabStop         =   0   'False
  129.       Top             =   2160
  130.       Width           =   975
  131.    End
  132.    Begin MSComctlLib.Toolbar tbSetup 
  133.       Height          =   330
  134.       Left            =   1065
  135.       TabIndex        =   6
  136.       Top             =   2520
  137.       Width           =   2115
  138.       _ExtentX        =   3731
  139.       _ExtentY        =   582
  140.       ButtonWidth     =   1826
  141.       ButtonHeight    =   582
  142.       AllowCustomize  =   0   'False
  143.       Wrappable       =   0   'False
  144.       Style           =   1
  145.       TextAlignment   =   1
  146.       ImageList       =   "imgNorm"
  147.       HotImageList    =   "imgHot"
  148.       _Version        =   393216
  149.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  150.          NumButtons      =   2
  151.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  152.             Caption         =   "&OK    "
  153.             ImageIndex      =   1
  154.          EndProperty
  155.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  156.             Caption         =   "&Cancel "
  157.             ImageIndex      =   2
  158.             Object.Width           =   500
  159.          EndProperty
  160.       EndProperty
  161.    End
  162.    Begin VB.Label lblLabels 
  163.       Caption         =   "Network ID"
  164.       Height          =   255
  165.       Index           =   0
  166.       Left            =   120
  167.       TabIndex        =   12
  168.       Top             =   240
  169.       Width           =   1215
  170.    End
  171.    Begin VB.Label lblLabels 
  172.       Caption         =   "Computer Name"
  173.       Height          =   255
  174.       Index           =   1
  175.       Left            =   120
  176.       TabIndex        =   11
  177.       Top             =   720
  178.       Width           =   1215
  179.    End
  180.    Begin VB.Label lblLabels 
  181.       Caption         =   "Local IP"
  182.       Height          =   255
  183.       Index           =   2
  184.       Left            =   120
  185.       TabIndex        =   10
  186.       Top             =   1200
  187.       Width           =   1215
  188.    End
  189.    Begin VB.Label lblLabels 
  190.       Caption         =   "&Screen Name"
  191.       Height          =   255
  192.       Index           =   3
  193.       Left            =   120
  194.       TabIndex        =   0
  195.       Top             =   1680
  196.       Width           =   1215
  197.    End
  198.    Begin VB.Label lblLabels 
  199.       Caption         =   "&UDP Port"
  200.       Height          =   255
  201.       Index           =   4
  202.       Left            =   120
  203.       TabIndex        =   2
  204.       Top             =   2160
  205.       Width           =   1215
  206.    End
  207. Attribute VB_Name = "frmProperties"
  208. Attribute VB_GlobalNameSpace = False
  209. Attribute VB_Creatable = False
  210. Attribute VB_PredeclaredId = True
  211. Attribute VB_Exposed = False
  212. Option Explicit
  213. Private Sub cmdCancel_Click()
  214.     Call Unload(Me)
  215. End Sub
  216. Private Sub cmdOK_Click()
  217. On Error GoTo ErrHndlr
  218.     Screen.MousePointer = vbHourglass
  219.     Call SaveNewSettings
  220.     Call Unload(Me)
  221. ErrHndlr:
  222.     Screen.MousePointer = vbDefault
  223. End Sub
  224. Private Sub Form_Load()
  225.     txtNetworkID.Text = frmMain.NetworkID
  226.     txtIP.Text = frmMain.LongIP
  227.     txtComputerName.Text = frmMain.ComputerName
  228.     txtName.Text = frmMain.ScreenName
  229.     txtUDPPort.Text = frmMain.wsUDP.LocalPort
  230.     Call FieldsCanUpdate
  231. End Sub
  232. Private Sub tbSetup_ButtonClick(ByVal Button As MSComctlLib.Button)
  233.     Select Case Button.Index
  234.         Case 1
  235.             Call cmdOK_Click
  236.         Case 2
  237.             Call cmdCancel_Click
  238.     End Select
  239. End Sub
  240. Private Sub txtName_Change()
  241.     Call FieldsCanUpdate
  242. End Sub
  243. Private Sub txtUDPPort_Change()
  244.     Call FieldsCanUpdate
  245. End Sub
  246. Private Sub txtUDPPort_KeyPress(KeyAscii As Integer)
  247.     Select Case KeyAscii
  248.         Case 3
  249.             'ctrl c
  250.         Case 8
  251.             'backspace
  252.         Case 24
  253.             'ctrl x
  254.         Case Is < 48
  255.             KeyAscii = 0
  256.         Case Is > 57
  257.             KeyAscii = 0
  258.     End Select
  259. End Sub
  260. Private Function SaveNewSettings()
  261.     If txtName.Text <> frmMain.ScreenName Or _
  262.         txtUDPPort.Text <> frmMain.wsUDP.LocalPort Then
  263.         
  264.         Call frmMain.Logoff
  265.         frmMain.ScreenName = Trim(txtName.Text)
  266.         Call frmMain.SaveScreenName(frmMain.ScreenName)
  267.         Call frmMain.SaveUDPPort(txtUDPPort.Text)
  268.         frmMain.wsUDP.Close
  269.         Call frmMain.SetUDPPort(txtUDPPort.Text)
  270.         Call frmMain.Logon
  271.     End If
  272. End Function
  273. Private Function FieldsCanUpdate() As Boolean
  274.     FieldsCanUpdate = False
  275.     Select Case True
  276.         Case Len(Trim(txtName.Text)) = 0
  277.         Case Len(txtUDPPort.Text) = 0
  278.         Case Else
  279.             FieldsCanUpdate = True
  280.     End Select
  281.     cmdOK.Enabled = FieldsCanUpdate
  282.     tbSetup.Buttons(1).Enabled = FieldsCanUpdate
  283. End Function
  284.