home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Power Pack / Visual_Basic4_Power_Pack.bin / vb4files / simulate / form1.frm (.txt) next >
Encoding:
Visual Basic Form  |  1996-11-20  |  9.1 KB  |  293 lines

  1. VERSION 4.00
  2. Begin VB.Form fForm1 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Simulate TextBox By Label - DEMO"
  5.    ClientHeight    =   4125
  6.    ClientLeft      =   810
  7.    ClientTop       =   1800
  8.    ClientWidth     =   7365
  9.    ControlBox      =   0   'False
  10.    Height          =   4530
  11.    Left            =   750
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   4125
  16.    ScaleWidth      =   7365
  17.    Top             =   1455
  18.    Width           =   7485
  19.    Begin VB.TextBox Text1 
  20.       Height          =   285
  21.       Left            =   360
  22.       TabIndex        =   8
  23.       TabStop         =   0   'False
  24.       Top             =   3120
  25.       Visible         =   0   'False
  26.       Width           =   615
  27.    End
  28.    Begin VB.CommandButton bExit 
  29.       Caption         =   "&Exit"
  30.       Height          =   375
  31.       Left            =   3240
  32.       TabIndex        =   9
  33.       TabStop         =   0   'False
  34.       Top             =   3720
  35.       Width           =   975
  36.    End
  37.    Begin VB.Label Label2 
  38.       BackColor       =   &H00C0C0C0&
  39.       Caption         =   "(This field is not enabled, try to click on it...)"
  40.       ForeColor       =   &H00000000&
  41.       Height          =   225
  42.       Index           =   4
  43.       Left            =   960
  44.       TabIndex        =   17
  45.       Top             =   2640
  46.       Width           =   3135
  47.    End
  48.    Begin VB.Label Label2 
  49.       BackColor       =   &H00C0C0C0&
  50.       Caption         =   "&Date"
  51.       ForeColor       =   &H00000000&
  52.       Height          =   225
  53.       Index           =   0
  54.       Left            =   120
  55.       TabIndex        =   16
  56.       Top             =   2280
  57.       Width           =   735
  58.    End
  59.    Begin VB.Label Label1 
  60.       BackColor       =   &H00FFFFFF&
  61.       BorderStyle     =   1  'Fixed Single
  62.       Caption         =   "01/01/96"
  63.       Enabled         =   0   'False
  64.       Height          =   255
  65.       Index           =   7
  66.       Left            =   960
  67.       TabIndex        =   7
  68.       Top             =   2280
  69.       Width           =   975
  70.    End
  71.    Begin VB.Label Label2 
  72.       BackColor       =   &H00C0C0C0&
  73.       Caption         =   "&ST"
  74.       ForeColor       =   &H00000000&
  75.       Height          =   225
  76.       Index           =   13
  77.       Left            =   2760
  78.       TabIndex        =   15
  79.       Top             =   1920
  80.       Width           =   375
  81.    End
  82.    Begin VB.Label Label1 
  83.       BackColor       =   &H00FFFFFF&
  84.       BorderStyle     =   1  'Fixed Single
  85.       Height          =   255
  86.       Index           =   6
  87.       Left            =   3120
  88.       TabIndex        =   6
  89.       Top             =   1920
  90.       Width           =   375
  91.    End
  92.    Begin VB.Label Label1 
  93.       BackColor       =   &H00FFFFFF&
  94.       BorderStyle     =   1  'Fixed Single
  95.       Caption         =   "Brigliadoro"
  96.       Height          =   255
  97.       Index           =   1
  98.       Left            =   960
  99.       TabIndex        =   1
  100.       Top             =   840
  101.       Width           =   3615
  102.    End
  103.    Begin VB.Label Label1 
  104.       BackColor       =   &H00FFFFFF&
  105.       BorderStyle     =   1  'Fixed Single
  106.       Height          =   255
  107.       Index           =   2
  108.       Left            =   960
  109.       TabIndex        =   2
  110.       Top             =   1200
  111.       Width           =   3615
  112.    End
  113.    Begin VB.Label Label1 
  114.       BackColor       =   &H00FFFFFF&
  115.       BorderStyle     =   1  'Fixed Single
  116.       Height          =   255
  117.       Index           =   3
  118.       Left            =   960
  119.       TabIndex        =   3
  120.       Top             =   1560
  121.       Width           =   3615
  122.    End
  123.    Begin VB.Label Label1 
  124.       BackColor       =   &H00FFFFFF&
  125.       BorderStyle     =   1  'Fixed Single
  126.       Height          =   255
  127.       Index           =   4
  128.       Left            =   960
  129.       TabIndex        =   4
  130.       Top             =   1920
  131.       Width           =   1695
  132.    End
  133.    Begin VB.Label Label1 
  134.       BackColor       =   &H00FFFFFF&
  135.       BorderStyle     =   1  'Fixed Single
  136.       Height          =   255
  137.       Index           =   5
  138.       Left            =   3600
  139.       TabIndex        =   5
  140.       Top             =   1920
  141.       Width           =   975
  142.    End
  143.    Begin VB.Label Label1 
  144.       BackColor       =   &H00FFFFFF&
  145.       BorderStyle     =   1  'Fixed Single
  146.       Caption         =   "Silvio"
  147.       Height          =   255
  148.       Index           =   0
  149.       Left            =   960
  150.       TabIndex        =   0
  151.       Top             =   480
  152.       Width           =   3615
  153.    End
  154.    Begin VB.Label Label2 
  155.       BackColor       =   &H00C0C0C0&
  156.       Caption         =   "&Address"
  157.       ForeColor       =   &H00000000&
  158.       Height          =   225
  159.       Index           =   8
  160.       Left            =   120
  161.       TabIndex        =   14
  162.       Top             =   1560
  163.       Width           =   735
  164.    End
  165.    Begin VB.Label Label2 
  166.       BackColor       =   &H00C0C0C0&
  167.       Caption         =   "&City"
  168.       ForeColor       =   &H00000000&
  169.       Height          =   225
  170.       Index           =   7
  171.       Left            =   120
  172.       TabIndex        =   13
  173.       Top             =   1920
  174.       Width           =   735
  175.    End
  176.    Begin VB.Label Label2 
  177.       BackColor       =   &H00C0C0C0&
  178.       Caption         =   "&First"
  179.       ForeColor       =   &H00000000&
  180.       Height          =   225
  181.       Index           =   3
  182.       Left            =   120
  183.       TabIndex        =   12
  184.       Top             =   480
  185.       Width           =   735
  186.    End
  187.    Begin VB.Label Label2 
  188.       BackColor       =   &H00C0C0C0&
  189.       Caption         =   "&Last"
  190.       ForeColor       =   &H00000000&
  191.       Height          =   225
  192.       Index           =   2
  193.       Left            =   120
  194.       TabIndex        =   11
  195.       Top             =   840
  196.       Width           =   735
  197.    End
  198.    Begin VB.Label Label2 
  199.       BackColor       =   &H00C0C0C0&
  200.       Caption         =   "&Company"
  201.       ForeColor       =   &H00000000&
  202.       Height          =   225
  203.       Index           =   1
  204.       Left            =   120
  205.       TabIndex        =   10
  206.       Top             =   1200
  207.       Width           =   735
  208.    End
  209.    Begin VB.Shape Shape2 
  210.       BorderColor     =   &H00FFFFFF&
  211.       Height          =   3540
  212.       Left            =   0
  213.       Top             =   15
  214.       Width           =   7335
  215.    End
  216.    Begin VB.Shape Shape1 
  217.       Height          =   3540
  218.       Left            =   0
  219.       Top             =   0
  220.       Width           =   7320
  221.    End
  222. Attribute VB_Name = "fForm1"
  223. Attribute VB_Creatable = False
  224. Attribute VB_Exposed = False
  225. '********************************
  226. 'This is just a demo of a VB 4 application that uses
  227. 'Label controls to simulate Text controls.
  228. 'Please note that you MUST set the TABSTOP property
  229. 'to false for all controls in the form.
  230. 'Set the TabIndex property for the Labels to the
  231. 'desidered value. You can use the mouse or the TAB
  232. 'key to scan all controls. It will act just as if you
  233. 'had TEXT controls; but notice that they are all labels.
  234. 'There is 1 hidden (visible=false) text control.
  235. 'All Comments are Welcome to:
  236. 'E-MAIL : 103113,352 (Compuserve)
  237. 'I wrote this utility in just an hour, you could modify it to
  238. 'accept many more features.
  239. 'Please note that the frame control isn't a frame control.
  240. Option Explicit
  241. Private pCurrentTab As Integer
  242. Dim i As Integer
  243. Private Sub bExit_Click()
  244.     End
  245. End Sub
  246. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  247.     If KeyCode = 9 Then TabPressed Shift
  248. End Sub
  249. Private Sub TabPressed(Shift As Integer)
  250.    'When need to change tabs do this:
  251.    ' are we going to the next or previous tab?
  252.    If Shift = 0 Then
  253.     'Next
  254.     pCurrentTab = pCurrentTab + 1
  255.     If pCurrentTab > Label1.Count - 1 Then pCurrentTab = 0
  256.      Else
  257.        'previous
  258.        pCurrentTab = pCurrentTab - 1
  259.        If pCurrentTab < 0 Then pCurrentTab = Label1.Count - 1
  260.     End If
  261.     'find index for the current tab
  262.     For i = 0 To Label1.Count - 1
  263.         If pCurrentTab = Val(Label1(i).TabIndex) Then Label1_Click (i)
  264.     Next i
  265.          
  266. End Sub
  267. Private Sub Form_Load()
  268.     'initialize to 1st. possible tab
  269.     pCurrentTab = -1
  270.     SendKeys "{tab}"
  271. End Sub
  272. Private Sub Label1_Click(Index As Integer)
  273.     'al work is done here...
  274.     pCurrentTab = Trim$(Str$(Label1(Index).TabIndex))
  275.     If Label1(pCurrentTab).Enabled = False Then SendKeys "{tab}"
  276.     If Text1.Visible Then
  277.         Label1(Val(Text1.Tag)).Caption = Text1.Text
  278.         Label1(Val(Text1.Tag)).Visible = True
  279.         Text1.Visible = False
  280.     End If
  281.     Text1.Width = Label1(Index).Width
  282.     Text1.Move Label1(Index).Left, Label1(Index).Top
  283.     'Text1.Height = Label1(Index).Height
  284.     Text1.Tag = Trim$(Str$(Index))
  285.     Label1(Index).Visible = False
  286.     Text1.Text = Label1(Index).Caption
  287.     Text1.Visible = True
  288.     Text1.SetFocus
  289. End Sub
  290. Private Sub Text1_KeyCode(KeyCode As Integer, Shift As Integer)
  291.         If KeyCode = 9 Then TabPressed Shift
  292. End Sub
  293.