Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - RC Search Highlight Demo w/ Metrics.Text
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

RC Search Highlight Demo w/ Metrics.Text

 Post Reply Post Reply
Author
Message
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Topic: RC Search Highlight Demo w/ Metrics.Text
    Posted: 22 December 2010 at 9:25pm
I'm publishing this demo because I think it could be useful for others, however there are some apparent bugs in the RC that are preventing it from being perfectly useful at this point.

My hope is that the bugs will get fixed, and I can drop the [BUG] tag and replace it with [DEMO].

DEMO PURPOSE:
To show the benefits of using ReportRecordItem.Value, ReportRecordItem.Caption and Metrics.Text in the BeforeDrawRow event of the ReportControl.

The techniques used here will allow us to have a "smart" sort for columns, editable plain text, and fancy markup for dynamic display purposes.

CURRENT PROBLEMS:
1) Metrics.Text values are interfering with Tooltips (Oleg has said this should be fixed for V15)
2) Metrics.Text values are interfering with inplace edit window text.

SCREENSHOT:


DOWNLOAD:
uploads/2676/RcMetricsBugs.zip

Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 353
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post Posted: 28 July 2011 at 7:31am
Just found this today as I was looking for a method to filter/search rows within a ReportControl with a TreeColumn.

The way in which I am using it is to display data only! So there's no editing involved within the grid, however I can confirm that this seems to work ok in v15.1.1 when in edit mode.

However if there is text in a column that is wider, normally an ellipsis appears and a tooltip is available, that disappears.

But despite this I have found this to be a useful addition to the ReportControl, with a little tweak to display numeric values as right aligned.


Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)
Back to Top
Willowmaster View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 July 2010
Location: Netherlands
Status: Offline
Points: 180
Post Options Post Options   Thanks (0) Thanks(0)   Quote Willowmaster Quote  Post ReplyReply Direct Link To This Post Posted: 28 July 2011 at 7:41am
That looks really neat! We have a search in searchresults field. This would be a nice way the highlight te keyword.
Product: Xtreme SuitePro (ActiveX) version 15.3.1

Platform: Windows XP (32bit) - SP 3 (on VMWare)

Language: Visual Basic 6.0



Back to Top
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 353
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post Posted: 28 July 2011 at 7:56am
Yeah that's what I thought when I found this, so I added the Highlight as an option (defaulted of course).
Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 28 July 2011 at 9:33am
You can get the ellipsis by changing the Metrics.Text line in the BeforeDrawRow event to:


      Metrics.Text = "<TextBlock TextTrimming='WordEllipsis'>" & l_MarkupText & "</TextBlock>"


or


      Metrics.Text = "<TextBlock TextTrimming='CharacterEllipsis'>" & l_MarkupText & "</TextBlock>"


For some reason, I can't get the tooltips to show even if I set the Markup ToolTip attribute though :( Maybe a bug?


Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 353
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post Posted: 28 July 2011 at 9:49am
Hi jpbro,

Thanks for the code sample on how to resolve the ellipsis issue I was having. I went for the CharacterEllipsis method as it keeps it inline with the way the ReportControl works.

Yeah I tried the Markup ToolTip also but couldn't get anything to show either. Possibly a bug, or just not supported by CJ it's anyones guess!
Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 28 July 2011 at 10:01am
Glad to help - sorry my post got a little mangled (fixed).
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 28 July 2011 at 11:32am
Originally posted by Xander75 Xander75 wrote:

Hi jpbro,

Thanks for the code sample on how to resolve the ellipsis issue I was having. I went for the CharacterEllipsis method as it keeps it inline with the way the ReportControl works.

Yeah I tried the Markup ToolTip also but couldn't get anything to show either. Possibly a bug, or just not supported by CJ it's anyones guess!
 
Hi,
 
I have Tooltips in ReportControl with MarkUp... Or is it with new version?
 
 
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
Back to Top
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 353
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post Posted: 28 July 2011 at 11:38am
Hi Aaron,

Yeah I am using v15.1.1 and the ToolTip does not appear to display for either the Span or TextBlock within the ReportControl.

Can you post a sample of how you done this so I can at least clarify if this is another bug with v15.1.1?
Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 28 July 2011 at 12:54pm
Hi,
 
    With RC
        .EnableMarkup = True
        With .Records.Add
            With .AddItem("1")
                .Caption = "<TextBlock ToolTip='abcd'>abc</TextBlock>"
            End With
 
 
Produces this:
 
 
 
 
 
 
 
 
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
Back to Top
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 353
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post Posted: 29 July 2011 at 3:55am
Thanks Aaron,

From your snippet of code I successfully managed to tweak the code to get the ToolTip property working with jpbro's Highlight code.



I updated the code in the BeforeDrawRow event:
Private Sub ReportControl1_BeforeDrawRow(ByVal Row As XtremeReportControl.IReportRow, ByVal Item As XtremeReportControl.IReportRecordItem, ByVal Metrics As XtremeReportControl.IReportRecordItemMetrics)
    Dim l_Text As String
    Dim l_MarkupText As String
    Dim l_Search As String
    Dim l_MatchPos As Long
    Dim l_LastMatchPos As Long
    Dim l_EntitySpacedText As String
    Dim i As Long
   
    If Me.ReportControl1.InplaceEditHwnd <> 0 Then
        If Row Is Me.ReportControl1.FocusedRow Then
            If Item.Index = Me.ReportControl1.FocusedColumn.ItemIndex Then
                ' Added code to help avoid a nasty crash when in edit mode when using the Item.Value, using Item.Caption shows the Markup...
                l_Text = Item.Value
                SendMessage rpcGrid(Index).InplaceEditHwnd, WM_SETTEXT, 0, ByVal l_Text
                Exit Sub
            End If
        End If
    End If
  
    l_Text = EncodePlainTextForXaml(Item.Value)
    l_Search = EncodePlainTextForXaml(txtSearch.Text)
        
    If LenB(l_Search) <> 0 Then
        l_LastMatchPos = 1
        l_MatchPos = 1
        Do
            l_MatchPos = InStr(l_MatchPos, l_Text, l_Search, vbTextCompare)
            If l_MatchPos > 0 Then
                m_FoundMatch = True

                l_EntitySpacedText = Mid$(l_Text, l_MatchPos, Len(l_Search))
                l_EntitySpacedText = Replace$(l_EntitySpacedText, " ", "&#32;")   ' Make sure leading and trailing spaces get highlighted by using the space entity.

                l_MarkupText = l_MarkupText & Mid$(l_Text, l_LastMatchPos, l_MatchPos - l_LastMatchPos)
                l_MarkupText = l_MarkupText & "<Span Background='#A0FFFF00' Foreground='Black'><Bold>" & l_EntitySpacedText & "</Bold></Span>"

                l_LastMatchPos = l_MatchPos + Len(l_Search)
                l_MatchPos = l_MatchPos + 1
            Else
                l_MarkupText = l_MarkupText & Mid$(l_Text, l_LastMatchPos)
            End If
        Loop While l_MatchPos > 0

        ' Right Align Numeric Values
        If IsNumeric(l_Text) Then
            Row.Record.Item(Item.Index).Caption = "<TextBlock TextAlignment='Right' TextTrimming='CharacterEllipsis' ToolTip='" & l_Text & "'>" & l_MarkupText & "</TextBlock>"
        Else
            Row.Record.Item(Item.Index).Caption = "<TextBlock TextTrimming='CharacterEllipsis' ToolTip='" & l_Text & "'>" & l_MarkupText & "</TextBlock>"
        End If
    Else
        Row.Record.Item(Item.Index).Caption = l_Text
   
End If

End Sub


This works fine for my needs, however when I tested this in jpbro's original demo I get the code to crash when in edit mode. But as I am not using the ReportControl in edit mode that's ok by me Wink
Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 29 July 2011 at 5:37am
Hi Alexander,
 
I tried your code with V15.0.2 and it works OK, at least no crash.
 
 
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
Back to Top
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 353
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post Posted: 29 July 2011 at 5:51am
Hi Aaron,

The crash only happened as I had changed the line:
    SendMessage rpcGrid(Index).InplaceEditHwnd, WM_SETTEXT, 0, ByVal Item.Caption
to
    SendMessage rpcGrid(Index).InplaceEditHwnd, WM_SETTEXT, 0, ByVal Item.Value
However by updating the code to:
    l_Text = Item.Value
    SendMessage rpcGrid(Index).InplaceEditHwnd, WM_SETTEXT, 0, ByVal l_Text
Helps fix the crashing issue and displays the text in edit mode correctly, although there is a slight flicker of Markup.

I have updated my previous post above with this fix.
Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)
Back to Top
JamGodz View Drop Down
Groupie
Groupie
Avatar

Joined: 25 February 2010
Status: Offline
Points: 67
Post Options Post Options   Thanks (0) Thanks(0)   Quote JamGodz Quote  Post ReplyReply Direct Link To This Post Posted: 19 November 2011 at 6:26am
Hi Sir Xander! Good Day!

Just want to know of how you do it, the filter function... can you teach/post some sample code?
i saw your screenshot and that's all i need especially those above the reportcontrol... please...

Thank you.
Back to Top
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 353
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post Posted: 06 December 2011 at 5:13am
Hi JamGodz,

Well as for the code you can get this from jpbro's first post and change the code accordinly as per my fifth post.

As for the filter, well it's nothing more than a FlatEdit & PushButton control. I changed the way in which the filter worked by disabling and enabling a timer each time the filter was changed so as that it meant it would only filter after a few seconds of inactivity.

Private Sub tmrFilter_Timer()
    tmrFilter.Enabled = False
    Dim i As Long
   
    m_FoundMatch = False
   
    For i = 0 To 3
        With rpcGrid(i)
            .FilterText = Trim$(txtFilter.Text)
            .Navigator.MoveFirstVisibleRow
            .Populate
            .Redraw
        End With
    Next
   
    If LenB(txtFilter.Text) > 0 Then
        If m_FoundMatch Then
            For i = 0 To 3
                rpcGrid(i).ExpandAll True
            Next
            txtFilter.BackColor = vbWindowBackground
        Else
            txtFilter.BackColor = &H8282FF
        End If
    Else
        For i = 0 To 3
            rpcGrid(i).CollapseAll
        Next
        txtFilter.BackColor = vbWindowBackground
    End If
   
    For i = 0 To 3
        With rpcGrid(i)
            .Navigator.MoveFirstVisibleRow
        End With
    Next
End Sub

Private Sub txtFilter_Change()
    tmrFilter.Enabled = False
    tmrFilter.Enabled = True
    If Trim$(txtFilter.Text) = vbNullString Then Call tmrFilter_Timer
End Sub


As for the checkbox "Highlight Filtered Text", I added this later on and this can be added in the BeforeDrawRow event, simlpy replace the block of code in post five:

' Right Align Numeric Values
If IsNumeric(l_Text) Then
    Row.Record.Item(Item.Index).Caption = "<TextBlock TextAlignment='Right' TextTrimming='CharacterEllipsis' ToolTip='" & l_Text & "'>" & l_MarkupText & "</TextBlock>"
Else
    Row.Record.Item(Item.Index).Caption = "<TextBlock TextTrimming='CharacterEllipsis' ToolTip='" & l_Text & "'>" & l_MarkupText & "</TextBlock>"
End If


with the following code:

If CommandBars.FindControl(, ID_TOOLBAR_FILTER_HIGHLIGHT).Checked Then
    ' Right Align Numeric Values
    If IsNumeric(l_Text) Then
        Row.Record.Item(Item.Index).Caption = "<TextBlock TextAlignment='Right' TextTrimming='CharacterEllipsis' ToolTip='" & l_Text & "'>" & l_MarkupText & "</TextBlock>"
    Else
        Row.Record.Item(Item.Index).Caption = "<TextBlock TextTrimming='CharacterEllipsis' ToolTip='" & l_Text & "'>" & l_MarkupText & "</TextBlock>"
    End If
Else
    Row.Record.Item(Item.Index).Caption = l_Text
End If


Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)
Back to Top
JamGodz View Drop Down
Groupie
Groupie
Avatar

Joined: 25 February 2010
Status: Offline
Points: 67
Post Options Post Options   Thanks (0) Thanks(0)   Quote JamGodz Quote  Post ReplyReply Direct Link To This Post Posted: 08 December 2011 at 3:26am
Hi Xander! thank you for the reply and specially the code..
but i have found an error in

l_Text = EncodePlainTextForXaml(Item.Value)

its says "Object Variable or With block variable not set"

i have a 2 grouprow in my RC. how can avoid this error?

and it doesnt hightlight the grouprow.

thanks?
Back to Top
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 353
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post Posted: 09 December 2011 at 3:31am
Hi JamGodz,

I guess this issue is occuring due to the use of the GroupRow. I didn't test for that as I wasn't using it in my project, but I guess you'll need to add some code for Row.GroupRow.

If you can upload a sample I will try and help you out, although now that this forum takes a while for posts to display I can't imagine I can help before the weekend plus I am out of the office on Monday & Tuesday!
Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 09 December 2011 at 1:58pm
At the top of the BeforeDrawRow event, you could test like this:


If Row Is Nothing Then Exit Sub
If Row.GroupRow Then Exit Sub
If Item Is Nothing Then Exit Sub


This should prevent any errors (aircode, so hopefully I haven't made a mistake).

Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
JamGodz View Drop Down
Groupie
Groupie
Avatar

Joined: 25 February 2010
Status: Offline
Points: 67
Post Options Post Options   Thanks (0) Thanks(0)   Quote JamGodz Quote  Post ReplyReply Direct Link To This Post Posted: 10 December 2011 at 7:41am
Hi jpbro and Xander, below is my modification to cater the grouprow highlight.
but it only apply to grouprow coz i only trap to row.grouprow, i need also to filter/highlight the item not only the grouprow.


Pls any suggestion would be greatly appreciated.

Thanks.


Private Sub wndList_BeforeDrawRow(ByVal Row As XtremeReportControl.IReportRow, ByVal Item As XtremeReportControl.IReportRecordItem, ByVal Metrics As XtremeReportControl.IReportRecordItemMetrics)
    If wndList.InplaceEditHwnd <> 0 Then
        If Row Is wndList.FocusedRow Then
            If Item.index = wndList.FocusedColumn.ItemIndex Then
                ' Added code to help avoid a nasty crash when in edit mode when using the Item.Value, using Item.Caption shows the Markup...
                l_Text = Item.Value
                SendMessage wndList(Item.index).InplaceEditHwnd, WM_SETTEXT, 0, ByVal l_Text
                Exit Sub
            End If
        End If
    End If
   
    If Row.GroupRow Then
        Dim GroupRow As ReportGroupRow
        Set GroupRow = Row
        'l_Text = EncodePlainTextForXaml(Item.Value)
        l_Text = EncodePlainTextForXaml(HTMLClean(GroupRow.GroupCaption))
        l_Search = EncodePlainTextForXaml(txtFilter.Text)
            
        If LenB(l_Search) <> 0 Then
            l_LastMatchPos = 1
            l_MatchPos = 1
            Do
                l_MatchPos = InStr(l_MatchPos, l_Text, l_Search, vbTextCompare)
                If l_MatchPos > 0 Then
                    m_FoundMatch = True
   
                    l_EntitySpacedText = Mid$(l_Text, l_MatchPos, Len(l_Search))
                    l_EntitySpacedText = Replace$(l_EntitySpacedText, " ", "&#32;")   ' Make sure leading and trailing spaces get highlighted by using the space entity.
   
                    l_MarkupText = l_MarkupText & Mid$(l_Text, l_LastMatchPos, l_MatchPos - IIf(l_LastMatchPos > l_MatchPos, l_LastMatchPos = l_MatchPos, l_LastMatchPos))
                    l_MarkupText = l_MarkupText & "<Span Background='#A0FFFF00' Foreground='Black'><Bold>" & l_EntitySpacedText & "</Bold></Span>"
   
                    l_LastMatchPos = l_MatchPos + Len(l_Search)
                    l_MatchPos = l_MatchPos + 1
                Else
                    l_MarkupText = l_MarkupText & Mid$(l_Text, l_LastMatchPos)
                End If
            Loop While l_MatchPos > 0
            GroupRow.GroupCaption = "<TextBlock TextTrimming='CharacterEllipsis' ToolTip='" & l_Text & "'>" & l_MarkupText & "</TextBlock>"
        Else
            GroupRow.GroupCaption = HTMLClean(l_Text)
        End If
    End If
End Sub


below are my function to strip HTML tags.

Public Function HTMLClean(ByVal strText As String) As String
    Dim objRegEx As VBScript_RegExp_55.RegExp
  
    ' replace <br>'s for a newline
    strText = Replace$(strText, "<br>", Chr$(10), 1, -1, vbTextCompare)
  
    ' replace non-breaking spaces for a space
    strText = Replace$(strText, "&nbsp;", Chr$(32), 1, -1, vbTextCompare)
  
    ' create new regex object
    Set objRegEx = New VBScript_RegExp_55.RegExp
    objRegEx.Global = True ' don't just operate on first find.
  
    ' remove HTML tags
    objRegEx.Pattern = "<[^>]*>"
    strText = objRegEx.Replace(strText, "")
  
    ' ditch excessive white space
    objRegEx.Pattern = "\s+"
    strText = objRegEx.Replace(strText, " ")

    Set objRegEx = Nothing

    ' named-entities
    strText = Replace$(strText, "&gt;", ">", 1, -1, vbTextCompare)
    strText = Replace$(strText, "&lt;", "<", 1, -1, vbTextCompare)

    ' insert your favourite named-entities here.
    strText = Replace$(strText, "&amp;", "&", 1, -1, vbTextCompare)  ' must do last
  
    ' return
    HTMLClean = strText
End Function



[]
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 12 December 2011 at 10:11am
I haven't tested this, but it might work (may need some modifications, but it should put you on the right track):


Private Sub wndList_BeforeDrawRow(ByVal Row As XtremeReportControl.IReportRow, ByVal Item As XtremeReportControl.IReportRecordItem, ByVal Metrics As XtremeReportControl.IReportRecordItemMetrics)
    If wndList.InplaceEditHwnd <> 0 Then
        If Row Is wndList.FocusedRow Then
            If Item.index = wndList.FocusedColumn.ItemIndex Then
                ' Added code to help avoid a nasty crash when in edit mode when using the Item.Value, using Item.Caption shows the Markup...
                l_Text = Item.Value
                SendMessage wndList(Item.index).InplaceEditHwnd, WM_SETTEXT, 0, ByVal l_Text
                Exit Sub
            End If
        End If
    End If

    Dim GroupRow As ReportGroupRow

    If Row.GroupRow Then
        Set GroupRow = Row
        l_Text = EncodePlainTextForXaml(HTMLClean(GroupRow.GroupCaption))
    Else
        l_Text = EncodePlainTextForXaml(Item.Value)
    End If
    l_Search = EncodePlainTextForXaml(txtFilter.Text)
   
    If LenB(l_Search) <> 0 Then
        l_LastMatchPos = 1
        l_MatchPos = 1

        Do
            l_MatchPos = InStr(l_MatchPos, l_Text, l_Search, vbTextCompare)
            If l_MatchPos > 0 Then
                m_FoundMatch = True

                l_EntitySpacedText = Mid$(l_Text, l_MatchPos, Len(l_Search))
                l_EntitySpacedText = Replace$(l_EntitySpacedText, " ", "&#32;")   ' Make sure leading and trailing spaces get highlighted by using the space entity.

                l_MarkupText = l_MarkupText & Mid$(l_Text, l_LastMatchPos, l_MatchPos - IIf(l_LastMatchPos > l_MatchPos, l_LastMatchPos = l_MatchPos, l_LastMatchPos))
                l_MarkupText = l_MarkupText & "<Span Background='#A0FFFF00' Foreground='Black'><Bold>" & l_EntitySpacedText & "</Bold></Span>"

                l_LastMatchPos = l_MatchPos + Len(l_Search)
                l_MatchPos = l_MatchPos + 1
            Else
                l_MarkupText = l_MarkupText & Mid$(l_Text, l_LastMatchPos)
            End If
        Loop While l_MatchPos > 0

        l_Text = "<TextBlock TextTrimming='CharacterEllipsis' ToolTip='" & l_Text & "'>" & l_MarkupText & "</TextBlock>"
    Else
        l_Text = HTMLClean(l_Text)
    End If

    If GroupRow Is Nothing Then
        Item.Caption = l_Text
    Else
        GroupRow.GroupCaption = l_Text
    End If
End Sub

Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
JamGodz View Drop Down
Groupie
Groupie
Avatar

Joined: 25 February 2010
Status: Offline
Points: 67
Post Options Post Options   Thanks (0) Thanks(0)   Quote JamGodz Quote  Post ReplyReply Direct Link To This Post Posted: 13 December 2011 at 11:42pm
Hi jpbro

Thank you so much.. it really work!

but how i implented the filter to display only the hilighted data in the reportcontrol? using the txtFilter_Change event. But also how you add the flatedit in the toolbar without any problem coz i have successfully attached the flatedit control but when im going to click the control will move to somewhere in the form or to its original position in design time, but when i used vb6 intrinsic control this will not happen..


pls help.

thanks..
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.