home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / VISUAL_B / CODIGO_2 / PROMPT / PROMDEMO.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-01-26  |  5.3 KB  |  166 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Prompt Control Demo"
  5.    ClientHeight    =   6285
  6.    ClientLeft      =   900
  7.    ClientTop       =   1590
  8.    ClientWidth     =   7485
  9.    Height          =   6750
  10.    Icon            =   PROMDEMO.FRX:0000
  11.    Left            =   810
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   6285
  14.    ScaleWidth      =   7485
  15.    Top             =   1215
  16.    Width           =   7665
  17.    Begin CommandButton btnHelp 
  18.       Caption         =   "&Help"
  19.       Height          =   435
  20.       Left            =   5775
  21.       TabIndex        =   10
  22.       Top             =   5040
  23.       Width           =   1065
  24.    End
  25.    Begin CommandButton btnAbout 
  26.       Caption         =   "&About"
  27.       Height          =   435
  28.       Left            =   4515
  29.       TabIndex        =   9
  30.       Top             =   5040
  31.       Width           =   1065
  32.    End
  33.    Begin CommandButton btnExit 
  34.       Caption         =   "E&xit"
  35.       Height          =   435
  36.       Left            =   5775
  37.       TabIndex        =   8
  38.       Top             =   5565
  39.       Width           =   1065
  40.    End
  41.    Begin Prompt Prompt1 
  42.       BackColor       =   &H00FFFFFF&
  43.       BorderStyle     =   0  'None
  44.       ForeColor       =   &H00000000&
  45.       Height          =   2535
  46.       Left            =   630
  47.       ScrollBars      =   2  'Vertical
  48.       TabIndex        =   0
  49.       Top             =   735
  50.       Width           =   6210
  51.       WordDelimiters  =   ", :"
  52.    End
  53.    Begin Label Text4 
  54.       BackColor       =   &H00FFFFFF&
  55.       BorderStyle     =   1  'Fixed Single
  56.       Height          =   330
  57.       Left            =   630
  58.       TabIndex        =   3
  59.       Top             =   5355
  60.       Width           =   1590
  61.    End
  62.    Begin Label Text2 
  63.       BackColor       =   &H00FFFFFF&
  64.       BorderStyle     =   1  'Fixed Single
  65.       DragMode        =   1  'Automatic
  66.       Height          =   330
  67.       Left            =   630
  68.       TabIndex        =   2
  69.       Top             =   4515
  70.       Width           =   6210
  71.    End
  72.    Begin Label Text1 
  73.       BackColor       =   &H00FFFFFF&
  74.       BorderStyle     =   1  'Fixed Single
  75.       Height          =   330
  76.       Left            =   630
  77.       TabIndex        =   1
  78.       Top             =   3675
  79.       Width           =   6210
  80.    End
  81.    Begin Label Label4 
  82.       BackColor       =   &H00C0C0C0&
  83.       Caption         =   "Enter any text in the prompt box below.  Active keywords are 'calc', 'help', 'clear', and 'exit'."
  84.       Height          =   645
  85.       Left            =   630
  86.       TabIndex        =   7
  87.       Top             =   105
  88.       Width           =   4215
  89.    End
  90.    Begin Label Label3 
  91.       BackColor       =   &H00C0C0C0&
  92.       Caption         =   "Prompt1.NumWords"
  93.       Height          =   225
  94.       Left            =   630
  95.       TabIndex        =   6
  96.       Top             =   5145
  97.       Width           =   1905
  98.    End
  99.    Begin Label Label2 
  100.       BackColor       =   &H00C0C0C0&
  101.       Caption         =   "Prompt1.Words(i)"
  102.       Height          =   225
  103.       Left            =   630
  104.       TabIndex        =   5
  105.       Top             =   4305
  106.       Width           =   1590
  107.    End
  108.    Begin Label Label1 
  109.       BackColor       =   &H00C0C0C0&
  110.       Caption         =   "InputLine"
  111.       Height          =   225
  112.       Left            =   630
  113.       TabIndex        =   4
  114.       Top             =   3465
  115.       Width           =   1380
  116.    End
  117. Option Explicit
  118. Declare Function WinHelp Lib "User" (ByVal hWnd As Integer, ByVal lpHelpFile As String, ByVal wCommand As Integer, dwData As Any) As Integer
  119. Sub btnAbout_Click ()
  120.    frmAbout.Show
  121. End Sub
  122. Sub btnExit_Click ()
  123.   End
  124. End Sub
  125. Sub btnHelp_Click ()
  126.    Dim iRV As Integer
  127.    iRV = WinHelp(Me.hWnd, "prompt.hlp", 3, 0)
  128. End Sub
  129. Sub Prompt1_Enter (InputLine As String)
  130.    Text1.Caption = InputLine
  131.    Text4.Caption = Str$(Prompt1.NumWords)
  132.    Text2.Caption = ""
  133.    Dim i As Long
  134.    If (Prompt1.NumWords > 0) Then
  135.       Text2.Caption = Prompt1.Words(0)
  136.    End If
  137.    For i = 1 To Prompt1.NumWords - 1
  138.       Text2.Caption = Text2.Caption & " | " & Prompt1.Words(i)
  139.    Next i
  140.    ' The following block of code is typical of code you would
  141.    ' use in an application to interpret commands entered
  142.    ' through the Prompt Control:
  143.    If (Prompt1.NumWords > 0) Then
  144.       Select Case Prompt1.Words(0)
  145.          Case "exit"
  146.             End
  147.          Case "help"
  148.             Dim NL As String
  149.             NL = Chr$(13) + Chr$(10)
  150.             'This demonstrates how you would display the results of a command
  151.             'entered in the prompt box by using the .AppendText property.
  152.             Prompt1.AppendText = NL
  153.             Prompt1.AppendText = NL + "COMMANDS:"
  154.             Prompt1.AppendText = NL + "  help       Shows this help message."
  155.             Prompt1.AppendText = NL + "  calc       Shell out to run the Windows Calculator."
  156.             Prompt1.AppendText = NL + "  clear      Clear the prompt box display."
  157.             Prompt1.AppendText = NL + "  exit       End the Prompt Control Demo."
  158.             Prompt1.AppendText = NL
  159.          Case "clear"
  160.             Prompt1.Text = ""
  161.          Case "calc"
  162.             i = Shell("Calc.EXE", 1)
  163.       End Select
  164.    End If
  165. End Sub
  166.