home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 6 / mastvb6.iso / leadtools / ocx32.lt / GETVALUE.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-03-27  |  4.2 KB  |  140 lines

  1. VERSION 5.00
  2. Begin VB.Form GetValueFrm 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H00C0C0C0&
  5.    BorderStyle     =   3  'Fixed Dialog
  6.    Caption         =   "GetValue"
  7.    ClientHeight    =   2250
  8.    ClientLeft      =   2625
  9.    ClientTop       =   2655
  10.    ClientWidth     =   4815
  11.    BeginProperty Font 
  12.       Name            =   "MS Sans Serif"
  13.       Size            =   8.25
  14.       Charset         =   0
  15.       Weight          =   700
  16.       Underline       =   0   'False
  17.       Italic          =   0   'False
  18.       Strikethrough   =   0   'False
  19.    EndProperty
  20.    ForeColor       =   &H80000008&
  21.    LinkTopic       =   "Form1"
  22.    MaxButton       =   0   'False
  23.    MinButton       =   0   'False
  24.    PaletteMode     =   1  'UseZOrder
  25.    ScaleHeight     =   2250
  26.    ScaleWidth      =   4815
  27.    Begin VB.CheckBox Resize_Horz 
  28.       Appearance      =   0  'Flat
  29.       BackColor       =   &H00C0C0C0&
  30.       Caption         =   "Resize/Horizontal"
  31.       ForeColor       =   &H80000008&
  32.       Height          =   315
  33.       Left            =   240
  34.       TabIndex        =   5
  35.       Top             =   1080
  36.       Width           =   2010
  37.    End
  38.    Begin VB.TextBox GetValueBox 
  39.       Appearance      =   0  'Flat
  40.       Height          =   330
  41.       Left            =   240
  42.       MaxLength       =   7
  43.       TabIndex        =   3
  44.       Text            =   "Text1"
  45.       Top             =   525
  46.       Width           =   735
  47.    End
  48.    Begin VB.HScrollBar GetValueBar 
  49.       Height          =   285
  50.       Left            =   1200
  51.       TabIndex        =   2
  52.       Top             =   540
  53.       Width           =   3375
  54.    End
  55.    Begin VB.CommandButton Cancel 
  56.       Appearance      =   0  'Flat
  57.       BackColor       =   &H80000005&
  58.       Cancel          =   -1  'True
  59.       Caption         =   "Cance&l"
  60.       Height          =   480
  61.       Left            =   2625
  62.       TabIndex        =   1
  63.       Top             =   1575
  64.       Width           =   1215
  65.    End
  66.    Begin VB.CommandButton OK 
  67.       Appearance      =   0  'Flat
  68.       BackColor       =   &H80000005&
  69.       Caption         =   "&OK"
  70.       Default         =   -1  'True
  71.       Height          =   480
  72.       Left            =   975
  73.       TabIndex        =   0
  74.       Top             =   1575
  75.       Width           =   1215
  76.    End
  77.    Begin VB.Label GetValueType 
  78.       Appearance      =   0  'Flat
  79.       BackColor       =   &H00C0C0C0&
  80.       Caption         =   "Label1"
  81.       ForeColor       =   &H80000008&
  82.       Height          =   270
  83.       Left            =   240
  84.       TabIndex        =   4
  85.       Top             =   240
  86.       Width           =   4350
  87.    End
  88. Attribute VB_Name = "GetValueFrm"
  89. Attribute VB_GlobalNameSpace = False
  90. Attribute VB_Creatable = False
  91. Attribute VB_PredeclaredId = True
  92. Attribute VB_Exposed = False
  93. Dim fValueChanged As Integer
  94. Private Sub Cancel_Click()
  95. End Sub
  96. Private Sub Form_Activate()
  97. GetValueBox.SetFocus
  98. GetValueBox.SelStart = 0
  99. GetValueBox.SelLength = Len(GetValueBox.Text)
  100. End Sub
  101. Private Sub Form_Load()
  102.   fValueChanged = False
  103.   left = (Screen.Width - Width) / 2
  104.   top = (Screen.Height - Height) / 2
  105. End Sub
  106. Private Sub GetValueBar_Change()
  107. If fValueChanged = False Then
  108.   fValueChanged = True
  109.   GetValueBox.Text = CStr(GetValueBar.Value)
  110. End If
  111. fValueChanged = False
  112. End Sub
  113. Private Sub GetValueBox_Change()
  114. If fValueChanged = False Then
  115.   fValueChanged = True
  116.   If Len(GetValueBox.Text) > 0 Then
  117.     If Val(GetValueBox.Text) <= GetValueBar.Max And Val(GetValueBox.Text) >= GetValueBar.Min Then
  118.       GetValueBar = Val(GetValueBox.Text)
  119.     Else
  120.       GetValueBox.Text = left(GetValueBox.Text, Len(GetValueBox.Text) - 1)
  121.       GetValueBox.SelStart = Len(GetValueBox.Text)
  122.     End If
  123.   End If
  124. End If
  125. fValueChanged = False
  126. End Sub
  127. Private Sub GetValueBox_GotFocus()
  128.   GetValueBox.SelStart = 0
  129.   GetValueBox.SelLength = Len(GetValueBox.Text)
  130. End Sub
  131. Private Sub OK_Click()
  132. If Len(GetValueBox.Text) > 0 Then
  133.   If Val(GetValueBox.Text) <= GetValueBar.Max And Val(GetValueBox.Text) >= GetValueBar.Min Then
  134.     gfGetValueGo = True
  135.     gnGetValueValue = GetValueBar.Value
  136.     Hide
  137.   End If
  138. End If
  139. End Sub
  140.