Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - BUG: Ctrl+Click
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

BUG: Ctrl+Click

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

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Topic: BUG: Ctrl+Click
    Posted: 15 June 2008 at 3:32pm
I have a ReportControl with these settings:


   With Me.ReportControl1
      .AllowColumnRemove = False
      .AllowColumnReorder = False
      .AllowColumnResize = False
      .AllowColumnSort = True
      .AllowEdit = False
      .AutoColumnSizing = True
      .MultipleSelection = False
      .MultiSelectionMode = False
      .PreviewMode = True
      .SelectionEnable = True
      .ShowRowFocus = False
    End With


The ReportControl has 2 records, and if the user presses Ctrl+Click on either record, the entire selection disappears (that is, no rows appear selected). I would think that the clicked row should be selected regardless of whether Ctrl is held when an item is clicked or not.

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

Language: Visual Basic 6.0 SP6

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

Joined: 02 February 2008
Status: Offline
Points: 156
Post Options Post Options   Thanks (0) Thanks(0)   Quote Smucker Quote  Post ReplyReply Direct Link To This Post Posted: 15 June 2008 at 3:55pm
I'm not very familiar with the report control, but Windows guidelines for extended selections cause Ctrl+Click to add or remove the clicked item from the list of selected items. It doesn't sound like this is happening.

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

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 15 June 2008 at 4:19pm
Hi Smucker,

Thanks for the reply...I would expect this too happen if the MultipleSelection property was True, since then adding and removing items by Ctrl+Click would be required. With MultipleSelection=False, I expected the ReportControl to leave at least one item selected at all times (this is how the ListBox appears to behave in single selection mode), but perhaps I need to enforce this behaviour myself.

Here's a workaround:


Private mlngReportControlMouseX As Long
private mlngReportControlMouseY As Long

Private Sub ReportControl1_MouseMove(Button As Integer, Shift As Integer, x As Long, y As Long)
   mlngReportControlMouseX = x
   mlngReportControlMouseY = y
End Sub

Private Sub ReportControl1_SelectionChanged()
   Dim objHT As ReportHitTestInfo
  
   If Me.ReportControl1.SelectedRows.Count = 0 Then
      Set objHT = Me.ReportControl1.HitTest(mlngReportControlMouseX, mlngReportControlMouseY)
      If Not objHT Is Nothing Then
         If Not objHT.Row Is Nothing Then
            Me.ReportControl1.Rows(objHT.Row.Index).Selected = True
         End If
      End If
   End If
End Sub


I tried a couple of other workarounds that I thought would be cleaner, but they failed for different reason. For example, recording only the Hit row in the MouseDown event when Ctrl has been pressed failed because it seems that SelectionChanged fires before MouseDown (strangely enough). A better method might be to use the GetCursorPos API to encapsulate all the logic in the SelectionChanged event.

I've only just started using the ReportControl, and I'm surprised to see no SelectionChanging event (or BeforeSelectionChanged) with the ability to cancel the change...It would have been useful in this case (and in others that I can imagine).
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
wlcabral View Drop Down
Groupie
Groupie
Avatar

Joined: 25 April 2007
Location: Brazil
Status: Offline
Points: 72
Post Options Post Options   Thanks (0) Thanks(0)   Quote wlcabral Quote  Post ReplyReply Direct Link To This Post Posted: 16 June 2008 at 11:46am

I´m using this code (MS FOXPRO) in MouseUp Event :

 

With xTremeReportControl

If NOT .multipleSelection

oItem = .FocusedRow

If !Isnull(oItem)

oItem.Selected = True

endif

endif

endwith

 

wlcabral
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 28 June 2008 at 10:21pm
Hi wlcabral...Sorry I must have missed your post earlier. Thanks a lot for this trimmed down solution, it is very useful!
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

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