home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c480 / 21.ddi / RCFRM.FR_ / RCFRM.bin (.txt)
Encoding:
Visual Basic Form  |  1993-02-14  |  13.9 KB  |  359 lines

  1. VERSION 2.00
  2. Begin Form RcFrm 
  3.    BackColor       =   &H00FFFFFF&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "RcResult Demonstration"
  6.    ControlBox      =   0   'False
  7.    Height          =   6690
  8.    Left            =   225
  9.    LinkMode        =   1  'Source
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   419
  12.    ScaleMode       =   3  'Pixel
  13.    ScaleWidth      =   604
  14.    Top             =   105
  15.    Width           =   9180
  16.    Begin PictureBox Picture1 
  17.       BackColor       =   &H00C0C0C0&
  18.       Height          =   1035
  19.       Index           =   0
  20.       Left            =   120
  21.       ScaleHeight     =   1005
  22.       ScaleWidth      =   8745
  23.       TabIndex        =   1
  24.       TabStop         =   0   'False
  25.       Top             =   120
  26.       Width           =   8775
  27.       Begin Label Label1 
  28.          Alignment       =   2  'Center
  29.          BackColor       =   &H00C0C0C0&
  30.          Caption         =   "The RcResult event occurs when a BEdit or HEdit control attempts to recognize the ink.  The event can be used as a trigger to create a 'locking' signature field.  Once the user stops inking, the field will be locked and no changes can be made."
  31.          FontBold        =   -1  'True
  32.          FontItalic      =   0   'False
  33.          FontName        =   "MS Sans Serif"
  34.          FontSize        =   9.75
  35.          FontStrikethru  =   0   'False
  36.          FontUnderline   =   0   'False
  37.          ForeColor       =   &H00000000&
  38.          Height          =   795
  39.          Index           =   0
  40.          Left            =   240
  41.          TabIndex        =   2
  42.          Top             =   120
  43.          Width           =   8355
  44.       End
  45.    End
  46.    Begin VHedit SigField 
  47.       BackColor       =   &H00FFFFFF&
  48.       DelayRecog      =   -1  'True
  49.       Height          =   855
  50.       InflateBottom   =   18
  51.       InflateLeft     =   18
  52.       InflateRight    =   18
  53.       InflateTop      =   18
  54.       Left            =   480
  55.       TabIndex        =   3
  56.       TabStop         =   0   'False
  57.       Top             =   1560
  58.       Version         =   268435458
  59.       Width           =   6135
  60.    End
  61.    Begin CommandButton ResetButton 
  62.       Caption         =   "Reset Signature"
  63.       Height          =   855
  64.       Left            =   6840
  65.       TabIndex        =   0
  66.       Top             =   1560
  67.       Width           =   1755
  68.    End
  69.    Begin PictureBox Picture1 
  70.       BackColor       =   &H00C0C0C0&
  71.       Height          =   855
  72.       Index           =   1
  73.       Left            =   120
  74.       ScaleHeight     =   825
  75.       ScaleWidth      =   8745
  76.       TabIndex        =   7
  77.       TabStop         =   0   'False
  78.       Top             =   2640
  79.       Width           =   8775
  80.       Begin Label Label1 
  81.          Alignment       =   2  'Center
  82.          BackColor       =   &H00C0C0C0&
  83.          Caption         =   "The RcResult event can be used to obtain a great deal of information about the recognition process.  When a word is evaluated only the most likely candidate is displayed, but with some manipulation all the possible results can be seen."
  84.          ForeColor       =   &H00000000&
  85.          Height          =   615
  86.          Index           =   1
  87.          Left            =   540
  88.          TabIndex        =   8
  89.          Top             =   120
  90.          Width           =   7755
  91.       End
  92.    End
  93.    Begin VHedit HEdit 
  94.       BackColor       =   &H00FFFFFF&
  95.       ForeColor       =   &H00000000&
  96.       Height          =   435
  97.       InflateBottom   =   18
  98.       InflateLeft     =   18
  99.       InflateRight    =   18
  100.       InflateTop      =   18
  101.       Left            =   2040
  102.       TabIndex        =   9
  103.       TabStop         =   0   'False
  104.       Top             =   3660
  105.       Version         =   268435458
  106.       Width           =   2535
  107.    End
  108.    Begin ListBox ListOfOptions 
  109.       BackColor       =   &H00FFFFFF&
  110.       ForeColor       =   &H00000000&
  111.       Height          =   810
  112.       Left            =   2040
  113.       TabIndex        =   6
  114.       TabStop         =   0   'False
  115.       Top             =   4680
  116.       Width           =   6855
  117.    End
  118.    Begin CommandButton Command1 
  119.       Caption         =   "Return to Main Menu"
  120.       FontBold        =   -1  'True
  121.       FontItalic      =   0   'False
  122.       FontName        =   "MS Sans Serif"
  123.       FontSize        =   9.75
  124.       FontStrikethru  =   0   'False
  125.       FontUnderline   =   0   'False
  126.       Height          =   495
  127.       Left            =   120
  128.       TabIndex        =   4
  129.       Top             =   5640
  130.       Width           =   8775
  131.    End
  132.    Begin Label Label2 
  133.       BackColor       =   &H00FFFFFF&
  134.       Caption         =   "Locking Signature Field"
  135.       ForeColor       =   &H00000000&
  136.       Height          =   255
  137.       Index           =   0
  138.       Left            =   2040
  139.       TabIndex        =   5
  140.       Top             =   1320
  141.       Width           =   2175
  142.    End
  143.    Begin Label Label2 
  144.       Alignment       =   1  'Right Justify
  145.       BackColor       =   &H00FFFFFF&
  146.       Caption         =   "Write a Word Here:"
  147.       ForeColor       =   &H00000000&
  148.       Height          =   255
  149.       Index           =   1
  150.       Left            =   180
  151.       TabIndex        =   10
  152.       Top             =   3780
  153.       Width           =   1755
  154.    End
  155.    Begin Label Label2 
  156.       Alignment       =   1  'Right Justify
  157.       BackColor       =   &H00FFFFFF&
  158.       Caption         =   "Symbol Graph:"
  159.       ForeColor       =   &H00000000&
  160.       Height          =   255
  161.       Index           =   3
  162.       Left            =   480
  163.       TabIndex        =   13
  164.       Top             =   4260
  165.       Width           =   1455
  166.    End
  167.    Begin Label GraphWnd 
  168.       BackColor       =   &H00FFFFFF&
  169.       BorderStyle     =   1  'Fixed Single
  170.       FontBold        =   -1  'True
  171.       FontItalic      =   0   'False
  172.       FontName        =   "Arial"
  173.       FontSize        =   9.75
  174.       FontStrikethru  =   0   'False
  175.       FontUnderline   =   0   'False
  176.       ForeColor       =   &H00000000&
  177.       Height          =   375
  178.       Left            =   2040
  179.       TabIndex        =   12
  180.       Top             =   4200
  181.       Width           =   6855
  182.    End
  183.    Begin Label Label2 
  184.       Alignment       =   1  'Right Justify
  185.       BackColor       =   &H00FFFFFF&
  186.       Caption         =   "Possible interpretations will appear here:"
  187.       ForeColor       =   &H00000000&
  188.       Height          =   675
  189.       Index           =   2
  190.       Left            =   480
  191.       TabIndex        =   11
  192.       Top             =   4740
  193.       Width           =   1455
  194.    End
  195. Option Base 1
  196. Sub AddToGraph (Syv&, SyvType&)
  197.     Select Case SyvType&
  198.         Case SYVHI_ANSI             'If an ANSI Symbol, add it to the graph
  199.             GraphWnd.Caption = GraphWnd.Caption + Chr$((Syv& And &HFF)) + " "
  200.         Case SYVHI_SPECIAL          'If the symbol is a Meta Symbol, replace it with a visible character
  201.             Select Case Syv&
  202.                 Case SYV_UNKNOWN
  203.                     GraphWnd.Caption = GraphWnd.Caption + "? "
  204.                 Case SYV_BEGINOR
  205.                     GraphWnd.Caption = GraphWnd.Caption + "{ "
  206.                 Case SYV_ENDOR
  207.                     GraphWnd.Caption = GraphWnd.Caption + "} "
  208.                 Case SYV_OR
  209.                     GraphWnd.Caption = GraphWnd.Caption + "| "
  210.             End Select
  211.         Case SYVHI_GESTURE          'If the symbol is a gesture, print the gesture name
  212.             Select Case Syv&
  213.                 Case SYV_CLEAR
  214.                     GraphWnd.Caption = " -- CLEAR Gesture"
  215.                 Case SYV_EXTENDSELECT
  216.                     GraphWnd.Caption = " -- EXTEND SELECT Gesture"
  217.                 Case SYV_UNDO
  218.                     GraphWnd.Caption = " -- UNDO Gesture"
  219.                 Case SYV_COPY
  220.                     GraphWnd.Caption = " -- COPY Gesture"
  221.                 Case SYV_PASTE
  222.                     GraphWnd.Caption = " -- PASTE Gesture"
  223.                 Case SYV_CLEARWORD
  224.                     GraphWnd.Caption = " -- CLEAR WORD Gesture"
  225.                 Case SYV_USER
  226.                     GraphWnd.Caption = " -- USER Gesture"
  227.                 Case SYV_BACKSPACE
  228.                     GraphWnd.Caption = " -- BACKSPACE Gesture"
  229.                 Case SYV_TAB
  230.                     GraphWnd.Caption = " -- TAB Gesture"
  231.                 Case SYV_RETURN
  232.                     GraphWnd.Caption = " -- RETURN Gesture"
  233.                 Case SYV_SPACE
  234.                     GraphWnd.Caption = " -- SPACE Gesture"
  235.                 Case SYV_CIRCLEUPA To SYV_CIRCLEUPZ
  236.                     GraphWnd.Caption = " -- Circle " + Chr$(Syv& - SYV_CIRCLEUPA + Asc("A")) + " Gesture"
  237.                 Case SYV_CIRCLELOA To SYV_CIRCLELOZ
  238.                     GraphWnd.Caption = " -- Circle " + Chr$(Syv& - SYV_CIRCLELOA + Asc("a")) + " Gesture"
  239.             End Select
  240.     End Select
  241. End Sub
  242. Sub Command1_Click ()
  243.     MainFrm.Show
  244.     RcFrm.Hide
  245. End Sub
  246. Sub Form_Load ()
  247.     SigField.EraseInk = True
  248.     SigField.Enabled = True
  249.     ResetButton.Enabled = False
  250. End Sub
  251. Sub HEdit_RcResult (RcResult As Long)
  252.     Rem --- This example prints out the symbol graph and a list
  253.     Rem --- Of all the possible purmutations of the graph
  254.     Dim VBRC As RcResult      'RCRESULT Structure
  255.     Dim SyeTable() As SYE     'Table of Symbol Elements
  256.     Dim LenArr() As Integer   'Length Array used in Determing all posiblile entries
  257.     Const SizeOfArr = 200
  258.     ReDim LenArr(SizeOfArr)
  259.     Rem --- Set Mouse pointer to HourGlass
  260.     Screen.MousePointer = 11
  261.     Rem --- Get a copy of the RcResult Structure
  262.     CPointerToVBType ByVal RcResult, VBRC, 80
  263.     Rem --- Determine the number of symbols in the graph and get their address
  264.     NumOfSymbols% = VBRC.SYGraph.cSye
  265.     lpSye& = VBRC.SYGraph.lpSye
  266.     Rem -- Allocate space for the graph and make a copy of it
  267.     ReDim SyeTable(NumOfSymbols%)
  268.     CPointerToVBType ByVal lpSye&, SyeTable(1), NumOfSymbols% * 12
  269.     Rem --- Clear the Graph label
  270.     GraphWnd.Caption = " "
  271.     Rem --- Clear previous entries from the List box
  272.     ListOfOptions.Clear
  273.     Rem --- Set Flags and variables used in the Permuation Algorithm
  274.     OrMode = False
  275.     OrModeBottom = 0
  276.     CurrentBottom = 0
  277.     Rem --- Traverse the Symbol Graph
  278.     For i% = 1 To NumOfSymbols%
  279.         Syv& = SyeTable(i%).Syv         'Get symbol value
  280.         SyvType& = Syv& \ &H10000       'Calculate symbol type (SYVH_???) of symbol
  281.                                         'By looking at the HiWord
  282.         Rem --- Call subroutine to add symbol to graph
  283.         AddToGraph Syv&, SyvType&
  284.         Rem ------------------------------------------------------------
  285.         Rem -- This is the permutation algorithm. This is included only
  286.         Rem -- as an example of the information that may be gained from
  287.         Rem -- the examination of the symbol graph.  Windows for Pens
  288.         Rem -- provides an EnumSymbols API that in C can be used to
  289.         Rem -- produce a similar list.
  290.         Rem ------------------------------------------------------------
  291.         Select Case SyvType&
  292.             Case SYVHI_ANSI                             'If an ASCI Symbol then
  293.                 If (ListOfOptions.ListCount = 0) Then       'Add to list if list is empty
  294.                     ListOfOptions.AddItem Chr$((Syv& And &HFF))
  295.                 Else
  296.                     Rem --- Otherwise Check to see if an OR symbol has been encountered
  297.                     If (OrMode) Then            'If so Duplicate Data
  298.                         For j% = 1 To OrModeBottom
  299.                             If (ListOfOptions.ListCount >= SizeOfArr) Then GoTo OverFlowErr
  300.                             ListOfOptions.AddItem Left$(ListOfOptions.List(j% - 1), LenArr(j%))
  301.                         Next j%
  302.                     End If
  303.                 
  304.                     For j% = CurrentBottom To (ListOfOptions.ListCount - 1)
  305.                         ListOfOptions.List(j%) = ListOfOptions.List(j%) + Chr$((Syv& And &HFF))
  306.                     Next j%
  307.                 
  308.                     If ((OrModeBottom = 0) And (OrMode)) Then
  309.                         If (ListOfOptions.ListCount >= SizeOfArr) Then GoTo OverFlowErr
  310.                         ListOfOptions.AddItem Chr$((Syv& And &HFF))
  311.                     End If
  312.                 
  313.                     OrMode = False
  314.                 End If
  315.             
  316.             Case SYVHI_SPECIAL
  317.                 Rem --- If a special Symbol, determine which one
  318.                 Select Case Syv&
  319.                     Case SYV_BEGINOR
  320.                         Rem --- Save the current lengths of all elements
  321.                         For j% = 1 To ListOfOptions.ListCount
  322.                             LenArr(j%) = Len(ListOfOptions.List(j% - 1))
  323.                         Next j%
  324.                         Rem --- And make sure to note where the bottom of the list is
  325.                         OrModeBottom = ListOfOptions.ListCount
  326.                         CurrentBottom = 0
  327.                 
  328.                     Case SYV_ENDOR
  329.                         Rem --- Reset Flags
  330.                         OrMode = False
  331.                         OrModeBottom = 0
  332.                         CurrentBottom = 0
  333.                     Case SYV_OR
  334.                         Rem --- Record an Or
  335.                         OrMode = True
  336.                         CurrentBottom = ListOfOptions.ListCount
  337.                 End Select
  338.         End Select
  339.     Next i%
  340.     Rem --- Restore Mouse pointer
  341.     Screen.MousePointer = 0
  342.     Exit Sub
  343. OverFlowErr:
  344.     Rem --- Array too small
  345.     Rem --- Restore Mouse Pointer
  346.     Screen.MousePointer = 0
  347.     MsgBox "Too many entries in table, did not complete", 64
  348.     Exit Sub
  349. End Sub
  350. Sub ResetButton_Click ()
  351.     ResetButton.Enabled = False
  352.     SigField.EraseInk = True
  353.     SigField.Enabled = True
  354. End Sub
  355. Sub SigField_RcResult (RcResult As Long)
  356.     SigField.Enabled = False
  357.     ResetButton.Enabled = True
  358. End Sub
  359.