Print Page | Close Window

[SOLVED] SelectionChanged don't fires sometimes!

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=18044
Printed Date: 15 November 2024 at 6:33pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [SOLVED] SelectionChanged don't fires sometimes!
Posted By: Jebo
Subject: [SOLVED] SelectionChanged don't fires sometimes!
Date Posted: 12 March 2011 at 3:32pm
Hello CJ-Team,

the "SelectionChanged" Event doesn't fires, if some records are invisible! Ouch

Please see the attached sample-code for a better understanding.

  >>> uploads/1570/ReportControl_SelectAll_Bug.zip - uploads/1570/ReportControl_SelectAll_Bug.zip

Please, is there a workaround or fix available - or do I something wrong?





Replies:
Posted By: Peter59
Date Posted: 13 March 2011 at 1:43am
Hi Jebo,

I'm not from the CJ-Team Wink but I can confirm your observation.

A possible workaround could be to select all visible rows manually:
Private Sub ReportControl1_PreviewKeyDown(KeyCode As Integer, ByVal Shift As Integer, Cancel As Boolean)
    Select Case KeyCode
    Case vbKeyA
        If Shift And vbCtrlMask Then
            '-- select rows manually
            ReportControl1.Navigator.MoveFirstRow
            ReportControl1.Navigator.MoveLastRow True
        End If
    End Select
End Sub

This works for me, see attached sample. uploads/3156/SelectionChanged_problem.zip - uploads/3156/SelectionChanged_problem.zip

Peter



-------------
Product: Xtreme SuitePro (ActiveX) version 15.2.1
Platform: Windows 7 64 Bit
Language: Visual Basic 6.0 SP6


Posted By: Aaron
Date Posted: 13 March 2011 at 3:17am
Hi,
 
Fix: Don't know, guess you have to submit ticket Wink
 
Workaround: Add a dummy record at the end and make sure this record is visible at all times.
 
In your case:
 
Private Sub ReportControl1_ValueChanged(ByVal Row As XtremeReportControl.IReportRow, ByVal Column As XtremeReportControl.IReportColumn, ByVal Item As XtremeReportControl.IReportRecordItem)
If ReportControl1.Navigator.CurrentFocusInHeadersRows Then
    Dim Rec As ReportRecord, sTmp As String, c As Long, R As Long
   
    sTmp = ReportControl1.HeaderRecords(0).Item(1).Value
      
    If sTmp <> "" Then
        For R = 0 To ReportControl1.Records.Count - 1
            Set Rec = ReportControl1.Records(R)
            Rec.Visible = InStr(1, Rec.Item(1).Caption, sTmp, vbTextCompare)
        Next
      Else  ' Make all records visible
        For R = 0 To ReportControl1.Records.Count - 1
            ReportControl1.Records(R).Visible = True
        Next
    End If
End If
Me.ReportControl1.Records(Me.ReportControl1.Records.Count - 1).Visible = True
ReportControl1.Populate: ReportControl1_SelectionChanged
End Sub
 
 
The thing is that RC scrolls to last record when selecting all records with CTRL-A but if only AAA is visible last record with FFF isn't visible anymore. That's why you need a 'last' record that is always visible.
 
 
 


-------------
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....


Posted By: Jebo
Date Posted: 13 March 2011 at 5:27am
Thank you guys! Hug

Have opened a ticket and will try your workarounds.


-------------
[Sig removed by Admin: Signature can't exceed 40GB]


Posted By: Jebo
Date Posted: 13 March 2011 at 2:13pm
Originally posted by Peter59 Peter59 wrote:

Hi Jebo,
This works for me, see attached sample. uploads/3156/SelectionChanged_problem.zip - uploads/3156/SelectionChanged_problem.zip
Peter

Sorry Peter, but this workaround doesn't work if the rows are grouped!

I hope CJ will fix this bug with v15.0.3.



-------------
[Sig removed by Admin: Signature can't exceed 40GB]


Posted By: Peter59
Date Posted: 13 March 2011 at 2:42pm
Doing it manually - second attempt!

Hi Jebo,

with a little modification, CTRL+A will select all rows even when they are grouped:
Private Sub ReportControl1_PreviewKeyDown(KeyCode As Integer, ByVal Shift As Integer, Cancel As Boolean)

    Dim rptRow As XtremeReportControl.ReportRow

    Select Case KeyCode
    Case vbKeyA
        If Shift And vbCtrlMask Then
            '-- select rows manually
            For Each rptRow In ReportControl1.Rows
                If Not rptRow.GroupRow Then rptRow.Selected = True
            Next
        End If
        ReportControl1_SelectionChanged
    End Select
End Sub

See attached sample. uploads/3156/SelectionChanged_problem2.zip - uploads/3156/SelectionChanged_problem2.zip

Peter




-------------
Product: Xtreme SuitePro (ActiveX) version 15.2.1
Platform: Windows 7 64 Bit
Language: Visual Basic 6.0 SP6


Posted By: Jebo
Date Posted: 13 March 2011 at 3:19pm
Hi Peter,

thanks!

I go this way:

            RecordsSelCount = 0
            For Each Row In RepCtrl.SelectedRows
                RecordsSelCount = RecordsSelCount + 1
            Next
msgbox RecordsSelCount

BUT your and my workaround is really slow!
So I hope CJ will fix the SelRow-Counter!


-------------
[Sig removed by Admin: Signature can't exceed 40GB]


Posted By: ABuenger
Date Posted: 14 March 2011 at 10:38pm
Hi,

I can confirm that this is a bug in 15.0.2. I'll fix it for 15.0.3 tomorrow. As a workaround the following code should work:

Private Sub ReportControl1_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyA And Shift = 2 Then
        ReportControl1_SelectionChanged
    End If
End Sub

Andre



-------------
Codejock support



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net