home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_BAS / PROMPT.ZIP / PROMDEMO.FRM < prev    next >
Text File  |  1994-01-26  |  5KB  |  184 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. End
  118.  
  119. Option Explicit
  120.  
  121.  
  122.  
  123.  
  124. Declare Function WinHelp Lib "User" (ByVal hWnd As Integer, ByVal lpHelpFile As String, ByVal wCommand As Integer, dwData As Any) As Integer
  125.  
  126. Sub btnAbout_Click ()
  127.    frmAbout.Show
  128. End Sub
  129.  
  130. Sub btnExit_Click ()
  131.   End
  132. End Sub
  133.  
  134. Sub btnHelp_Click ()
  135.    Dim iRV As Integer
  136.    iRV = WinHelp(Me.hWnd, "prompt.hlp", 3, 0)
  137. End Sub
  138.  
  139. Sub Prompt1_Enter (InputLine As String)
  140.  
  141.  
  142.    Text1.Caption = InputLine
  143.    Text4.Caption = Str$(Prompt1.NumWords)
  144.  
  145.    Text2.Caption = ""
  146.    Dim i As Long
  147.    If (Prompt1.NumWords > 0) Then
  148.       Text2.Caption = Prompt1.Words(0)
  149.    End If
  150.    For i = 1 To Prompt1.NumWords - 1
  151.       Text2.Caption = Text2.Caption & " | " & Prompt1.Words(i)
  152.    Next i
  153.  
  154.  
  155.    ' The following block of code is typical of code you would
  156.    ' use in an application to interpret commands entered
  157.    ' through the Prompt Control:
  158.    If (Prompt1.NumWords > 0) Then
  159.       Select Case Prompt1.Words(0)
  160.          Case "exit"
  161.             End
  162.          Case "help"
  163.             Dim NL As String
  164.             NL = Chr$(13) + Chr$(10)
  165.             'This demonstrates how you would display the results of a command
  166.             'entered in the prompt box by using the .AppendText property.
  167.             Prompt1.AppendText = NL
  168.             Prompt1.AppendText = NL + "COMMANDS:"
  169.             Prompt1.AppendText = NL + "  help       Shows this help message."
  170.             Prompt1.AppendText = NL + "  calc       Shell out to run the Windows Calculator."
  171.             Prompt1.AppendText = NL + "  clear      Clear the prompt box display."
  172.             Prompt1.AppendText = NL + "  exit       End the Prompt Control Demo."
  173.             Prompt1.AppendText = NL
  174.  
  175.          Case "clear"
  176.             Prompt1.Text = ""
  177.          Case "calc"
  178.             i = Shell("Calc.EXE", 1)
  179.       End Select
  180.    End If
  181.  
  182. End Sub
  183.  
  184.