home *** CD-ROM | disk | FTP | other *** search
/ On Hand / On_Hand_From_Softbank_1994_Release_2_Disc_2_1994.iso / 00202 / s / disk3 / rcfrm.fr_ / rcfrm.bin
Text File  |  1993-04-28  |  14KB  |  391 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. End
  196. Option Base 1
  197.  
  198. Sub AddToGraph (Syv&, SyvType&)
  199.     Select Case SyvType&
  200.         Case SYVHI_ANSI             'If an ANSI Symbol, add it to the graph
  201.             GraphWnd.Caption = GraphWnd.Caption + Chr$((Syv& And &HFF)) + " "
  202.         Case SYVHI_SPECIAL          'If the symbol is a Meta Symbol, replace it with a visible character
  203.             Select Case Syv&
  204.                 Case SYV_UNKNOWN
  205.                     GraphWnd.Caption = GraphWnd.Caption + "? "
  206.                 Case SYV_BEGINOR
  207.                     GraphWnd.Caption = GraphWnd.Caption + "{ "
  208.                 Case SYV_ENDOR
  209.                     GraphWnd.Caption = GraphWnd.Caption + "} "
  210.                 Case SYV_OR
  211.                     GraphWnd.Caption = GraphWnd.Caption + "| "
  212.             End Select
  213.         Case SYVHI_GESTURE          'If the symbol is a gesture, print the gesture name
  214.             Select Case Syv&
  215.                 Case SYV_CLEAR
  216.                     GraphWnd.Caption = " -- CLEAR Gesture"
  217.                 Case SYV_EXTENDSELECT
  218.                     GraphWnd.Caption = " -- EXTEND SELECT Gesture"
  219.                 Case SYV_UNDO
  220.                     GraphWnd.Caption = " -- UNDO Gesture"
  221.                 Case SYV_COPY
  222.                     GraphWnd.Caption = " -- COPY Gesture"
  223.                 Case SYV_PASTE
  224.                     GraphWnd.Caption = " -- PASTE Gesture"
  225.                 Case SYV_CLEARWORD
  226.                     GraphWnd.Caption = " -- CLEAR WORD Gesture"
  227.                 Case SYV_USER
  228.                     GraphWnd.Caption = " -- USER Gesture"
  229.                 Case SYV_BACKSPACE
  230.                     GraphWnd.Caption = " -- BACKSPACE Gesture"
  231.                 Case SYV_TAB
  232.                     GraphWnd.Caption = " -- TAB Gesture"
  233.                 Case SYV_RETURN
  234.                     GraphWnd.Caption = " -- RETURN Gesture"
  235.                 Case SYV_SPACE
  236.                     GraphWnd.Caption = " -- SPACE Gesture"
  237.                 Case SYV_CIRCLEUPA To SYV_CIRCLEUPZ
  238.                     GraphWnd.Caption = " -- Circle " + Chr$(Syv& - SYV_CIRCLEUPA + Asc("A")) + " Gesture"
  239.                 Case SYV_CIRCLELOA To SYV_CIRCLELOZ
  240.                     GraphWnd.Caption = " -- Circle " + Chr$(Syv& - SYV_CIRCLELOA + Asc("a")) + " Gesture"
  241.             End Select
  242.     End Select
  243.  
  244.  
  245. End Sub
  246.  
  247. Sub Command1_Click ()
  248.     MainFrm.Show
  249.     RcFrm.Hide
  250. End Sub
  251.  
  252. Sub Form_Load ()
  253.     SigField.EraseInk = True
  254.     SigField.Enabled = True
  255.     ResetButton.Enabled = False
  256. End Sub
  257.  
  258. Sub HEdit_RcResult (RcResult As Long)
  259.     Rem --- This example prints out the symbol graph and a list
  260.     Rem --- Of all the possible purmutations of the graph
  261.  
  262.     Dim VBRC As RcResult      'RCRESULT Structure
  263.     Dim SyeTable() As SYE     'Table of Symbol Elements
  264.     Dim LenArr() As Integer   'Length Array used in Determing all posiblile entries
  265.     Const SizeOfArr = 200
  266.     ReDim LenArr(SizeOfArr)
  267.  
  268.     Rem --- Set Mouse pointer to HourGlass
  269.     Screen.MousePointer = 11
  270.  
  271.     Rem --- Get a copy of the RcResult Structure
  272.     CPointerToVBType ByVal RcResult, VBRC, 80
  273.  
  274.     Rem --- Determine the number of symbols in the graph and get their address
  275.     NumOfSymbols% = VBRC.SYGraph.cSye
  276.     lpSye& = VBRC.SYGraph.lpSye
  277.  
  278.     Rem -- Allocate space for the graph and make a copy of it
  279.     ReDim SyeTable(NumOfSymbols%)
  280.     CPointerToVBType ByVal lpSye&, SyeTable(1), NumOfSymbols% * 12
  281.  
  282.     Rem --- Clear the Graph label
  283.     GraphWnd.Caption = " "
  284.  
  285.     Rem --- Clear previous entries from the List box
  286.     ListOfOptions.Clear
  287.  
  288.     Rem --- Set Flags and variables used in the Permuation Algorithm
  289.     OrMode = False
  290.     OrModeBottom = 0
  291.     CurrentBottom = 0
  292.  
  293.     Rem --- Traverse the Symbol Graph
  294.     For i% = 1 To NumOfSymbols%
  295.         Syv& = SyeTable(i%).Syv         'Get symbol value
  296.         SyvType& = Syv& \ &H10000       'Calculate symbol type (SYVH_???) of symbol
  297.                                         'By looking at the HiWord
  298.         Rem --- Call subroutine to add symbol to graph
  299.         AddToGraph Syv&, SyvType&
  300.     
  301.         Rem ------------------------------------------------------------
  302.         Rem -- This is the permutation algorithm. This is included only
  303.         Rem -- as an example of the information that may be gained from
  304.         Rem -- the examination of the symbol graph.  Windows for Pens
  305.         Rem -- provides an EnumSymbols API that in C can be used to
  306.         Rem -- produce a similar list.
  307.         Rem ------------------------------------------------------------
  308.  
  309.         Select Case SyvType&
  310.             Case SYVHI_ANSI                             'If an ASCI Symbol then
  311.                 If (ListOfOptions.ListCount = 0) Then       'Add to list if list is empty
  312.                     ListOfOptions.AddItem Chr$((Syv& And &HFF))
  313.                 Else
  314.                     Rem --- Otherwise Check to see if an OR symbol has been encountered
  315.                     If (OrMode) Then            'If so Duplicate Data
  316.                         For j% = 1 To OrModeBottom
  317.                             If (ListOfOptions.ListCount >= SizeOfArr) Then GoTo OverFlowErr
  318.                             ListOfOptions.AddItem Left$(ListOfOptions.List(j% - 1), LenArr(j%))
  319.                         Next j%
  320.                     End If
  321.                 
  322.                     For j% = CurrentBottom To (ListOfOptions.ListCount - 1)
  323.                         ListOfOptions.List(j%) = ListOfOptions.List(j%) + Chr$((Syv& And &HFF))
  324.                     Next j%
  325.                 
  326.                     If ((OrModeBottom = 0) And (OrMode)) Then
  327.                         If (ListOfOptions.ListCount >= SizeOfArr) Then GoTo OverFlowErr
  328.                         ListOfOptions.AddItem Chr$((Syv& And &HFF))
  329.                     End If
  330.                 
  331.                     OrMode = False
  332.  
  333.                 End If
  334.             
  335.             Case SYVHI_SPECIAL
  336.                 Rem --- If a special Symbol, determine which one
  337.  
  338.                 Select Case Syv&
  339.                     Case SYV_BEGINOR
  340.                         Rem --- Save the current lengths of all elements
  341.                         For j% = 1 To ListOfOptions.ListCount
  342.                             LenArr(j%) = Len(ListOfOptions.List(j% - 1))
  343.                         Next j%
  344.                         Rem --- And make sure to note where the bottom of the list is
  345.                         OrModeBottom = ListOfOptions.ListCount
  346.                         CurrentBottom = 0
  347.                 
  348.                     Case SYV_ENDOR
  349.                         Rem --- Reset Flags
  350.                         OrMode = False
  351.                         OrModeBottom = 0
  352.                         CurrentBottom = 0
  353.  
  354.                     Case SYV_OR
  355.                         Rem --- Record an Or
  356.                         OrMode = True
  357.                         CurrentBottom = ListOfOptions.ListCount
  358.  
  359.                 End Select
  360.         End Select
  361.  
  362.     Next i%
  363.  
  364.     Rem --- Restore Mouse pointer
  365.     Screen.MousePointer = 0
  366.  
  367.     Exit Sub
  368.  
  369.  
  370. OverFlowErr:
  371.     Rem --- Array too small
  372.  
  373.     Rem --- Restore Mouse Pointer
  374.     Screen.MousePointer = 0
  375.     MsgBox "Too many entries in table, did not complete", 64
  376.     Exit Sub
  377.  
  378. End Sub
  379.  
  380. Sub ResetButton_Click ()
  381.     ResetButton.Enabled = False
  382.     SigField.EraseInk = True
  383.     SigField.Enabled = True
  384. End Sub
  385.  
  386. Sub SigField_RcResult (RcResult As Long)
  387.     SigField.Enabled = False
  388.     ResetButton.Enabled = True
  389. End Sub
  390.  
  391.