Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - [HOW TO] Use a FilterBar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[HOW TO] Use a FilterBar

 Post Reply Post Reply
Author
Message
gibra View Drop Down
Senior Member
Senior Member


Joined: 31 October 2008
Location: Italy
Status: Offline
Points: 288
Post Options Post Options   Thanks (0) Thanks(0)   Quote gibra Quote  Post ReplyReply Direct Link To This Post Topic: [HOW TO] Use a FilterBar
    Posted: 30 April 2011 at 4:34am
Should be good if Report Control to hold a FilterBar like this (C1 TrueDBGrid control): Wink
 
 
Thank Smile
gibra
CJ SuiteControl v: 13.x to 19.x
Windows 10 64bit
VS2019 - VB6.0 SP6
<a href="http://nuke.vbcorner.net/Home/tabid/36/language/en-US/Default.aspx" rel="nofollow">VS/VB 6.0 Installer v6.8
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: 30 April 2011 at 5:52am
Hi,

There is an example of how to do this already in the ReportControl samples. I have already used it in one of my projects. I tweaked the code however to allow for multiple filter selections.
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
gibra View Drop Down
Senior Member
Senior Member


Joined: 31 October 2008
Location: Italy
Status: Offline
Points: 288
Post Options Post Options   Thanks (0) Thanks(0)   Quote gibra Quote  Post ReplyReply Direct Link To This Post Posted: 30 April 2011 at 8:04am
Yes, your refer to Excel sample.
But I can choose only for existing values from the combo.
 
There is a way to apply the filter while typing something in a row filter?
 
The ValueChanged  and ValueChanging  events will not fire.
 
There is other event for this use?
gibra
CJ SuiteControl v: 13.x to 19.x
Windows 10 64bit
VS2019 - VB6.0 SP6
<a href="http://nuke.vbcorner.net/Home/tabid/36/language/en-US/Default.aspx" rel="nofollow">VS/VB 6.0 Installer v6.8
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: 01 May 2011 at 2:59am
Hi,
 
Yes, there is: InplaceEditChanging event
 
Something like this:
 
Private Sub wndReportControl_InplaceEditChanging(ByVal Row As XtremeReportControl.IReportRow, ByVal Column As XtremeReportControl.IReportColumn, ByVal Item As XtremeReportControl.IReportRecordItem, NewValue As String, Cancel As Boolean)
    Dim xtremeColumn As XtremeReportControl.ReportColumn
       
    For Each xtremeColumn In Me.wndReportControl.Columns
        'Only allow filter in particular column
        xtremeColumn.Filtrable = xtremeColumn.ItemIndex = Column.ItemIndex
    Next xtremeColumn
   
    Me.wndReportControl.FilterText = NewValue
   
    'Only necessary to store selection if Focus is lost when calling .Populate in timer event
    currentSelectedRow = Row.Index
    currentSelectedColumn = Column.ItemIndex

    'We need to update RC with call .Populate but wouldn't do that if I were you :P
    'IDE will crash !!! Also with compiled exe
    'Me.wndReportControlCountersTable.Populate
   
    'Don't see a way to update RC with applied filter except using a timer...
    TimerUpdateFilter.Enabled = True
   
End Sub
 
 
Private Sub TimerUpdateFilter_Timer()
    Me.TimerUpdateFilter.Enabled = False
    With Me.wndReportControl
        .Populate
       
        'Don't know if Focus will be lost with HeaderRows (only tried with ReportRecords) if not
        'forget following code... 
        .Navigator.MoveToRow currentSelectedRow 
        .Navigator.MoveToColumn currentSelectedColumn
        .Navigator.BeginEdit
       
    End With
End Sub
 
 
Maybe Andre has a solution to get around this without a hack  Wink
 
Good luck !
 
 
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
gibra View Drop Down
Senior Member
Senior Member


Joined: 31 October 2008
Location: Italy
Status: Offline
Points: 288
Post Options Post Options   Thanks (0) Thanks(0)   Quote gibra Quote  Post ReplyReply Direct Link To This Post Posted: 01 May 2011 at 2:59pm
Thank Aaron,
 
but your code don't work. Ouch
i.e. :
- I press 'S' in Subject column: grid become empty Confused
- Focus is always lost, so I can't continue to insert other chars.
 
 
gibra
CJ SuiteControl v: 13.x to 19.x
Windows 10 64bit
VS2019 - VB6.0 SP6
<a href="http://nuke.vbcorner.net/Home/tabid/36/language/en-US/Default.aspx" rel="nofollow">VS/VB 6.0 Installer v6.8
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: 02 May 2011 at 1:20am

Hi,

Maybe you can try this:

Private Sub TimerUpdateFilter_Timer()
    Me.TimerUpdateFilter.Enabled = False
    With Me.wndReportControlCountersTable
        .Populate
        Me.wndReportControlCountersTable.Columns(7).EditOptions.SelectTextOnEdit = False
        .Navigator.CurrentFocusInHeadersRows = True '<<<<<
        .Navigator.MoveToRow .SelectedRows(0).Index
        .Navigator.MoveToColumn 7 '.FocusedColumn.ItemIndex
        .Navigator.BeginEdit
       
    End With
End Sub

Maybe focus will stay in headerrow now...
 
 
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
gibra View Drop Down
Senior Member
Senior Member


Joined: 31 October 2008
Location: Italy
Status: Offline
Points: 288
Post Options Post Options   Thanks (0) Thanks(0)   Quote gibra Quote  Post ReplyReply Direct Link To This Post Posted: 03 May 2011 at 5:07am
Thank Aaron,
using
.Navigator.CurrentFocusInHeadersRows = True
 
the focus is correct.
 
However,
the FilterText property allow to use a single-value for all columns, is good, but does't what you want.
I would apply a multi-column filter, not a single-column filter.
I want insert texts in different columns to set a filter as a SQL statement as below:
 
display records WHERE
columns(1)  LIKE  <value1>  AND  columns(3)  LIKE  <value3>
 
It's possible?
 
Thank Smile
 
gibra
CJ SuiteControl v: 13.x to 19.x
Windows 10 64bit
VS2019 - VB6.0 SP6
<a href="http://nuke.vbcorner.net/Home/tabid/36/language/en-US/Default.aspx" rel="nofollow">VS/VB 6.0 Installer v6.8
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: 03 May 2011 at 5:18am
Hi gibra,

Yes a multiple filter can be done as I said in my first reply in this post. You need to change the code in the "FilterRows" procedure to suit the requirements of a multiple filter.

Below is the changed code in the "FilterRows" procedure I used to allow the use of a multiple filter:


Private Sub FilterRows(nColIdx As Integer)
    On Error GoTo ErrHandler
   
    Dim Column As ReportColumn
    Dim Record As ReportRecord
    Dim i As Integer, j As Integer
    Dim FilterValue As String, Value As String

    ' initially make all records visible
    For i = 0 To rpcGrid.Records.Count - 1
        Set Record = rpcGrid.Records(i)
        Record.Visible = True
    Next
   
    For i = 0 To rpcGrid.Columns.Count - 1
        Set Column = rpcGrid.Columns(i)
        If Not Column Is Nothing Then
            ' get filter's value
            FilterValue = vbNullString
            FilterValue = rpcGrid.HeaderRecords(0).Item(i).Value
           
            If FilterValue = "(All)" Then
                FilterValue = vbNullString
                rpcGrid.HeaderRecords(0).Item(i).Value = vbNullString
            End If
           
            If FilterValue <> vbNullString Then
                For j = 0 To rpcGrid.Records.Count - 1
               
                    Set Record = rpcGrid.Records(j)
                    Value = Record.Item(i).Value
                       
                    If FilterValue <> CStr(Value) Then Record.Visible = False
                Next
            End If
        End If
    Next
ErrHandler:
End Sub

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
gibra View Drop Down
Senior Member
Senior Member


Joined: 31 October 2008
Location: Italy
Status: Offline
Points: 288
Post Options Post Options   Thanks (0) Thanks(0)   Quote gibra Quote  Post ReplyReply Direct Link To This Post Posted: 03 May 2011 at 11:50am
Thank Xander75 for your reply.
 
I will try later.
 
Smile
gibra
CJ SuiteControl v: 13.x to 19.x
Windows 10 64bit
VS2019 - VB6.0 SP6
<a href="http://nuke.vbcorner.net/Home/tabid/36/language/en-US/Default.aspx" rel="nofollow">VS/VB 6.0 Installer v6.8
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.156 seconds.