N
NickP
Hi there,
My SmartTags are being recognised more than once, and as I have a
property that is initialised to a default value, it clears the tag, for
example
1. Type MyTag
2. Tag gets recognised, property "Stuff" is initialised with a value of
"Empty"
3. Invoke verb "Foobar", property "Stuff" gets changed to a temporary
filename
4. Press return
5. Repeat from step 2, then end
Sometimes it even gets recognised more than once in the first instance.
So basically, what I'm asking is, how do I stop this? I am following
the standard MS sample for recognising tags, and it is this that has the
bug...
----
http://msdn2.microsoft.com/en-us/library/aa163620(office.10).aspx
.......
Public Sub Recognize(ByVal strRecText As String, _
ByVal DataType As SmartTagLib.IF_TYPE, _
ByVal LocaleID As Integer, _
ByVal RecognizerSite As SmartTagLib.ISmartTagRecognizerSite) _
Implements SmartTagLib.ISmartTagRecognizer.Recognize
Dim intLocation As Integer = InStr(strRecText, "VB.NET",
CompareMethod.Text)
If intLocation > 0 Then
Dim stPropBag As ISmartTagProperties =
RecognizerSite.GetNewPropertyBag()
Dim strPropType As String
' Determine the data type (as a string).
Select Case DataType
Case IF_TYPE.IF_TYPE_CELL
strPropType = "IF_TYPE_CELL"
Case IF_TYPE.IF_TYPE_CHAR
strPropType = "IF_TYPE_CHAR"
Case IF_TYPE.IF_TYPE_PARA
strPropType = "IF_TYPE_PARA"
Case IF_TYPE.IF_TYPE_REGEXP
strPropType = "IF_TYPE_REGEXP"
Case IF_TYPE.IF_TYPE_SINGLE_WD
strPropType = "IF_TYPE_SINGLE_WD"
End Select
'Add the data type to the property bag.
stPropBag.Write("DataType", strPropType)
'Add the text sent to the function.
stPropBag.Write("Text", strRecText)
'Add the LocaleID.
stPropBag.Write("LocaleID", LocaleID)
'Commit the SmartTag.
RecognizerSite.CommitSmartTag("urn:samples-msdn-microsoft-
com#VBNetSmartTag", _
intLocation, 6, stPropBag) << this line ends up
getting called twice which overwrites the previous SmartTag.
End If
End Sub
-----
Some how, I need to check to see if the Smart Tag has already been
commited. But then again, surely if it has already been committed, it
shouldn't be recognising it again?
Thanks in advance.
Nick.
My SmartTags are being recognised more than once, and as I have a
property that is initialised to a default value, it clears the tag, for
example
1. Type MyTag
2. Tag gets recognised, property "Stuff" is initialised with a value of
"Empty"
3. Invoke verb "Foobar", property "Stuff" gets changed to a temporary
filename
4. Press return
5. Repeat from step 2, then end
Sometimes it even gets recognised more than once in the first instance.
So basically, what I'm asking is, how do I stop this? I am following
the standard MS sample for recognising tags, and it is this that has the
bug...
----
http://msdn2.microsoft.com/en-us/library/aa163620(office.10).aspx
.......
Public Sub Recognize(ByVal strRecText As String, _
ByVal DataType As SmartTagLib.IF_TYPE, _
ByVal LocaleID As Integer, _
ByVal RecognizerSite As SmartTagLib.ISmartTagRecognizerSite) _
Implements SmartTagLib.ISmartTagRecognizer.Recognize
Dim intLocation As Integer = InStr(strRecText, "VB.NET",
CompareMethod.Text)
If intLocation > 0 Then
Dim stPropBag As ISmartTagProperties =
RecognizerSite.GetNewPropertyBag()
Dim strPropType As String
' Determine the data type (as a string).
Select Case DataType
Case IF_TYPE.IF_TYPE_CELL
strPropType = "IF_TYPE_CELL"
Case IF_TYPE.IF_TYPE_CHAR
strPropType = "IF_TYPE_CHAR"
Case IF_TYPE.IF_TYPE_PARA
strPropType = "IF_TYPE_PARA"
Case IF_TYPE.IF_TYPE_REGEXP
strPropType = "IF_TYPE_REGEXP"
Case IF_TYPE.IF_TYPE_SINGLE_WD
strPropType = "IF_TYPE_SINGLE_WD"
End Select
'Add the data type to the property bag.
stPropBag.Write("DataType", strPropType)
'Add the text sent to the function.
stPropBag.Write("Text", strRecText)
'Add the LocaleID.
stPropBag.Write("LocaleID", LocaleID)
'Commit the SmartTag.
RecognizerSite.CommitSmartTag("urn:samples-msdn-microsoft-
com#VBNetSmartTag", _
intLocation, 6, stPropBag) << this line ends up
getting called twice which overwrites the previous SmartTag.
End If
End Sub
-----
Some how, I need to check to see if the Smart Tag has already been
commited. But then again, surely if it has already been committed, it
shouldn't be recognising it again?
Thanks in advance.
Nick.