Consecutive selection in RC with the mouse
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=15159
Printed Date: 21 November 2024 at 6:20pm Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Consecutive selection in RC with the mouse
Posted By: Fabian
Subject: Consecutive selection in RC with the mouse
Date Posted: 12 September 2009 at 8:34am
Hi
Working with VB6/SP6 and CJ Suite 13.1.0
Probably I am missing something because I can't believe, that such a basic operation as MouseDowen - Drag for selection - MouseUp is not implemented in RC...
Thanks for a hint
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.3
Platform: Windows 7 (32bit)
Language: Visual Basic 6.0 / SP6
|
Replies:
Posted By: mgampi
Date Posted: 12 September 2009 at 4:01pm
Did you enable multi selection?
------------- Martin
Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0 Platform: Windows 10 v 22H2 (64bit) Language: VC++ 2022
|
Posted By: Fabian
Date Posted: 13 September 2009 at 4:23am
Shure, but I can only select multiple rows with Shift&Click and Ctrl&Click. But in all Windows application you can select multiple rows by dragging the mouse while holding down the left mouse button (Explorer, Excel...).
But thanks for asking!
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.3
Platform: Windows 7 (32bit)
Language: Visual Basic 6.0 / SP6
|
Posted By: jpbro
Date Posted: 13 September 2009 at 11:30am
Hi Fabian, how do you get Explorer to allow you to select by dragging? For me it always drags the selected item.
Anyway, I agree that it would be a nice feature to add the RC as a property. It should be possible to implement yourself using the MouseEvents and hit testing, but of course this would be a bit of a pain.
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: jpbro
Date Posted: 13 September 2009 at 3:55pm
Hey Fabian,
I gave it a shot and came up with a class that seems to work pretty well. I haven't added many comments to the source code, so if you have any questions about it (or find any bugs), feel free to get back to me here.
An important note: I don't have permission to redistribute the source code for Karl E. Peterson's Timer class that I am using to handle auto-scrolling/selecting. You will have to download it and add the CTimer.cls and modTimer.bas files to the project in order for it to work (you don't need to reference any DLLs or OCXs, just use his VB6 code in my demo project). You can get his code from here:
http://vb.mvps.org/samples/snatch.asp?id=TimerObj - http://vb.mvps.org/samples/snatch.asp?id=TimerObj
There's more information about the timer here: http://vb.mvps.org/samples/TimerObj/ - http://vb.mvps.org/samples/TimerObj/
LOOK BELOW FOR LATEST SOURCE
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: Fabian
Date Posted: 14 September 2009 at 1:17am
Hi jbpro
If you start dragging right at the end of a column you can mark items with the mouse.
Yes I simulate this using mouse events and the RC Navigator but there are a lot of things to do (mouse up on a column with check boxes marks the checkbox, if you simply click in an edit box or a combo removes the focus immediately because I select the row and so on). Now I have a working version but I think that is basic and sould be done by RC!
Thats my code:
Private FirstRow1 As ReportRow
Private Sub ReportControl1_MouseDown(Button As Integer, Shift As Integer, x As Long, y As Long) Set FirstRow1 = Nothing If Button = vbLeftButton And Shift = 0 Then If ReportControl1.HitTest(x, y).ht = xtpHitTestReportArea Then If Not ReportControl1.HitTest(x, y).Item Is Nothing Then If ReportControl1.HitTest(x, y).Item.Index <> COL_NOTIZ2 Then 'This column is not allowed to start selection Set FirstRow1 = ReportControl1.HitTest(x, y).Row If Not FirstRow1 Is Nothing Then ReportControl1.SelectedRows.DeleteAll FirstRow1.Selected = True End If End If End If End If End If End Sub
Private Sub ReportControl1_MouseMove(Button As Integer, Shift As Integer, x As Long, y As Long) Dim Row As ReportRow If Button = vbLeftButton And Shift = 0 And Not FirstRow1 Is Nothing Then If ReportControl1.HitTest(x, y).ht = xtpHitTestReportArea Then Set Row = ReportControl1.HitTest(x, y).Row If Not Row Is Nothing Then ReportControl1.Navigator.MoveToRow Row.Index, True End If End If End If End Sub
Private Sub ReportControl1_MouseUp(Button As Integer, Shift As Integer, x As Long, y As Long) Dim Row As ReportRow If Button = vbLeftButton And Shift = 0 And Not FirstRow1 Is Nothing Then If ReportControl1.HitTest(x, y).ht = xtpHitTestReportArea Then ReportControl1.Navigator.MoveToRow FirstRow1.Index, False Set Row = ReportControl1.HitTest(x, y).Row If Not Row Is Nothing Then ReportControl1.Navigator.MoveToRow Row.Index, True End If End If End If End Sub
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.3
Platform: Windows 7 (32bit)
Language: Visual Basic 6.0 / SP6
|
Posted By: mdoubson
Date Posted: 17 September 2009 at 12:03pm
Fabian wrote:
Shure, but I can only select multiple rows with Shift&Click and Ctrl&Click. But in all Windows application you can select multiple rows by dragging the mouse while holding down the left mouse button (Explorer, Excel...).
But thanks for asking! |
What are you talking about, Fabian - at least under XP Explorer - if I am dragging mouse holding left mouse button - I only see one selected row (the row I start dragging) and moving drag and drop icon - not multiple rows...
In Excel this is possible but not in Explorer!
I guess that you mean Tracker mode when you start dragging outside item and tracker rectanlge cover several items - in this case it create multi-selection.
Explorer use this mode because it is convinient in IconView mode (and not very convinient in Table (ReportView) Mode).
But we don't use tracker-based selection in ReportControl...
------------- Mark Doubson, Ph.D.
|
Posted By: Fabian
Date Posted: 18 September 2009 at 1:48am
OK, Mark
Nonetheless I think RC is nearer to EXCEL as to explorer and this feature would be very handy for the user. I have found a solution with the Navigator class (s. post) but I would be happy if it was done by the component itself...
Only a wish!
Thanks for reading
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.3
Platform: Windows 7 (32bit)
Language: Visual Basic 6.0 / SP6
|
Posted By: jpbro
Date Posted: 18 September 2009 at 1:45pm
Hi Fabian, thanks for your code and sorry for the delay in getting back to you.
It seems that your code (as well as mine) suffers from the problem of checkboxes changing on MouseUp. This actually seems like a bug to me, since I would argue that a checkbox should only change if it is clicked (mouse down AND mouse up), not just on mouse up...wouldn't Drag & Drop cause a similar problem? I'll see if I can find a workaround.
Also, I don't know if you had a chance to try my code, but it offers some feature advantages over yours - mostly that it uses a timer so that users can continually extend the selection when the mouse is not over the RC any more (clicked and dragged the mouse off of the form for example).
But again, I do agree that this would be a nice built-in feature for the RC.
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: mdoubson
Date Posted: 18 September 2009 at 1:51pm
Btw - checkbox state changed only if you click inside checkbox glyph - not just inside cell
------------- Mark Doubson, Ph.D.
|
Posted By: jpbro
Date Posted: 18 September 2009 at 1:55pm
Thanks Mark - that's true with latest 13.2 (it wasn't true with the 13.2 I was using with working markup). In any case, I still think the checkbox should only be changed on MouseDown/MouseUp....not just MouseUp - try clicking and holding the mouse down on a completely separate row, then drag and release over a glyph on another row and it will get selected. This is unusual/non-intuitive behaviour for checkboxes in Windows.
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: jpbro
Date Posted: 18 September 2009 at 2:23pm
I've updated my demo to include a workaround to prevent accidental checkbox value changes on MouseUp. You will still need to add the CTimer.cls and modTimer.bas code separately (although you can try the included EXE for functionality testing without any additional downloads).
UPDATED SOURCE BELOW
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: jpbro
Date Posted: 18 September 2009 at 2:25pm
It would also be nice if there was a BeforeItemCheck() event with a Cancel parameter so that we could dynamically cancel item checking (or even just to record the previous CheckboxState for reverting/undo).
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: mdoubson
Date Posted: 18 September 2009 at 2:28pm
Jason I still not understand how your checkbox can change state if you not click (does not matter - say use MouseUp event) on the glyph?
------------- Mark Doubson, Ph.D.
|
Posted By: jpbro
Date Posted: 18 September 2009 at 2:37pm
It appears that the situation with the checkbox is somewhat improved with the latest 13.2, but it will still change the checkbox value when the mouse is down on the focused row (but not over the glyph) and then the mouse is up over the glyph. I would argue that the checkbox should only change value when the mouse is down over the glyph and then up over the same glyph.
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: jpbro
Date Posted: 18 September 2009 at 2:42pm
This sample demonstrates the problem:
uploads/20090918_144040_RcCheckboxSelec.zip - uploads/20090918_144040_RcCheckboxSelec.zip
Try Clicking on the non-checkbox column and then drag and release over a checkbox glyph. It will change value.
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: mdoubson
Date Posted: 18 September 2009 at 2:51pm
I did not see check effect - but I found bad effect of your autoselection in the case dragging column on report body - it show X-icon but still doing autoselection. This is not smart
------------- Mark Doubson, Ph.D.
|
Posted By: jpbro
Date Posted: 18 September 2009 at 3:09pm
Thanks for the bug report Mark. It should be fixed now for column header drag case:
UPDATED SOURCE BELOW!
If you don't see the checkbox issue, then it must be because you have a newer build? Did you test it with the small sample I provided (not the main drag selector demo)?
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: mdoubson
Date Posted: 18 September 2009 at 3:14pm
Get new build yourself please - https://forum.codejock.com/uploads/BetaOCX/ReportControlBeta13-2.rar - https://forum.codejock.com/uploads/BetaOCX/ReportControlBeta13-2.rar
so we can use same code
You new source is not buildable (runnable)
line WithEvents mo_AutoScrollTimer As CTimer
Compiler error: User defined type not defined
Please check and update
But I can run your exe - now no problems with X-Icon case and no problems with checkboxes!
------------- Mark Doubson, Ph.D.
|
Posted By: jpbro
Date Posted: 18 September 2009 at 3:29pm
Just tested with the latest build you provided, and I still see the problem. I tested with the CJ ReportSample, and here is what I notice:
1) Load the CJ Report sample and click Additional Samples > Tree View Dialog Sample. 2) Click and hold the left mouse over the selected row, but NOT over the checkbox glyph. 3) Drag the mouse (while still holding mouse button) and move the pointer over the checkbox glyph on the same (highlighted) row. 4) Release the mouse button, and the checkbox value will be changed.
I also notice a similar problem with RC buttons, but worse because you don't even have to release over the same row for a click to be registered:
1) Start the CJ report sample and click the Additional Samples menu > Report Items Sample. 2) Click and hold the mouse over any non-button part of a report row. 3) Drag the mouse (button down) over top of any of the buttons (even one on a non-selected row). 4) Release the mouse button over a item button and it will be clicked (the font will change bold/colour/whatever action for the button you released the mouse over).
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: jpbro
Date Posted: 18 September 2009 at 3:30pm
As for source not buildable/runnable, please see comments in source and in posts above - I don't have permission to redistribute the CTimer.cls and modTimer.bas source code, but it is available for public download. The exe is built with this code compiled in (that's why it works).
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: mdoubson
Date Posted: 18 September 2009 at 3:42pm
Are you talking about VB sample? I can't drag row in Tree Vew dialog - guess no DD flag set
But I can confirm that hold and release mouse on glyph area change check state
In Report Items Sample (with B, A and Alignment buttons) - I can't see autoclick effect
Why we have different behaviour?
------------- Mark Doubson, Ph.D.
|
Posted By: jpbro
Date Posted: 18 September 2009 at 3:54pm
Yes, the VB sample made by Codejock - Forget the fact that Drag & Drop isn't enabled, I'm just using it to demonstrate the point that if the left mouse button is released over the glyph of a checkbox on the currently selected row, then the checkbox value will change (checked if previously unchecked, or unchecked if previously checked) even if the left mouse button wasn't initially pressed over the glyph. Based on standard checkbox behaviour, the value should only change values if the left mouse button was pressed and released over it.
If you aren't seeing this or the button behaviour, then there is indeed something weird going on...I'm using Sep 18 @ 2:38PM build of 13.2, and it both issues are reproducible every time here. I'll try uninstalling completely, run a reg-cleaner and then re-install to be 100% sure I have the latest version. I can't figure out why we are seeing such different behaviour lately...
I know you asked Kurt about putting the build # in the About box (thanks for that), but if that isn't going to happen during the beta period, then how about a Version string property that shows the latest build number? At least then I can do a Debug.Print Me.ReportControl1.Version and be 100% sure I am not running into some kind of bizarre registry problem. Because this part of the beta testing process is wasting a lot of time...
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: mdoubson
Date Posted: 18 September 2009 at 4:10pm
OK - get now https://forum.codejock.com/uploads/BetaOCX/ReportControlBeta13-2.rar - https://forum.codejock.com/uploads/BetaOCX/ReportControlBeta13-2.rar and check about box please
------------- Mark Doubson, Ph.D.
|
Posted By: mdoubson
Date Posted: 18 September 2009 at 4:24pm
You are not 100% right about checkbox behaviour.
It is true if checkbox is stand-alone control in form - you need MouseDown-MouseUp on same glyph.
But buit-in checkbox (e.g. checkbox in MS DateTimePicker) - react on your first MouseDown - immediately
Btw - this is not difficult to implement checking mouse down and mouse up points to prevent this effect
------------- Mark Doubson, Ph.D.
|
Posted By: jpbro
Date Posted: 18 September 2009 at 4:34pm
IMHO, I think that an interface item should always react on MouseDown+MouseUp (Click), because this gives the user a chance to change their mind by dragging off of the control and the releasing the button. That said, I can see an argument for reaction on MouseDown only (especially in the case of things like touch or pen based interaction, since it is easy to accidentally move off of the control you are trying to click which becomes annoying quickly, and if you touch something on the screen, you likely did it on purpose).
Both of those things said, I can not agree that an item should ever react on MouseUp only - it would never be an intuitive behaviour. So MouseDown=reaction or MouseDown+MouseUp=reaction would be acceptable in my opinion, but never MouseUp=reaction.
Anyway, I've just cleaned out my system and restarted, so I am about to install the latest update for testing and I will get back to you with results shortly.
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: mdoubson
Date Posted: 18 September 2009 at 4:41pm
Please get again https://forum.codejock.com/uploads/BetaOCX/ReportControlBeta13-2.rar - https://forum.codejock.com/uploads/BetaOCX/ReportControlBeta13-2.rar
(rev 9644)and try checkbox case
------------- Mark Doubson, Ph.D.
|
Posted By: jpbro
Date Posted: 18 September 2009 at 5:01pm
I can confirme that I now have 9644 in IDE, and I can confirm that the checkbox case is now fixed. Thanks a lot Mark.
I still see the Item control issue though - Try the CJ Report Sample > Additional Samples > Record Item Controls Sample. Click and hold mouse over text portion of cell, drag and release over a button and the button will be clicked. It's easier to notice if you release over the non-selected row (in the case of the colour changing button). You will also notice the debug window print something like "ItemButtonClick. Row = 3, Item = 0, Control = 2".
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: mdoubson
Date Posted: 18 September 2009 at 5:07pm
Yes - I can also confirm the case if I release mouse under ANOTHER row button - not the same I click first.
------------- Mark Doubson, Ph.D.
|
Posted By: mdoubson
Date Posted: 18 September 2009 at 5:14pm
Try get update please now (9645)
------------- Mark Doubson, Ph.D.
|
Posted By: jpbro
Date Posted: 18 September 2009 at 5:18pm
Looks perfect, thanks Mark!
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: mdoubson
Date Posted: 18 September 2009 at 5:22pm
Good - could you try to find some other missing cases please?
E.g. - some internal editor activated without logical reason (focus on subitem we don't need in this moment)?
------------- Mark Doubson, Ph.D.
|
Posted By: jpbro
Date Posted: 18 September 2009 at 5:29pm
Sure, I just found another in CJ RC sample. On the main sample report, click and hold over a regular row item then drag & release over the group expand/collapse glyph and it will be clicked.
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: mdoubson
Date Posted: 18 September 2009 at 5:30pm
Thanks - it is also simple
------------- Mark Doubson, Ph.D.
|
Posted By: jpbro
Date Posted: 18 September 2009 at 5:31pm
Also, I don't know if this is designed behaviour or not, but each time you click the group expand/collapse glyph (properly, mousedown/up over glyph), the selection highlight toggles on/off. If you double-click the group row (not the glyph) to expand or collapse the group, this doesn't happen (selection highlight always remains visible).
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: jpbro
Date Posted: 18 September 2009 at 5:32pm
Same thing for hyperlinks - click elsewhere then release over a hyperlink fires click. This can also be tested in the main sample report in the CJ sample.
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: mdoubson
Date Posted: 18 September 2009 at 5:36pm
Please try same case now with new update 9646
------------- Mark Doubson, Ph.D.
|
Posted By: jpbro
Date Posted: 18 September 2009 at 5:37pm
Same problem with expand/collapse glyphs in TreeView sample (not sure if this is the same code as group expand/collapse, so that's why I mention it) but only if you click and release in the focused row!
Try the CJ Report Sample > Additional Samples > Tree View Dialog Sample. Click and hold over "Bruce Wayne" then drag and release over the glyph beside "Re:" on the same row. It will expand the tree node.
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: mdoubson
Date Posted: 18 September 2009 at 5:38pm
You can also use Control + Click on group row - see differences
------------- Mark Doubson, Ph.D.
|
Posted By: jpbro
Date Posted: 18 September 2009 at 5:41pm
I can confirm I have 9646, but I don't see a different result for expand/collapse glyph mouseup...
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: jpbro
Date Posted: 18 September 2009 at 5:42pm
Okay, I see fix for Tree View expand/collapse, but not for Group row expand/collapse.
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: mdoubson
Date Posted: 18 September 2009 at 5:47pm
try next 9647 and check hyperlink case please
and group row also - I don't touch it in prev rev
------------- Mark Doubson, Ph.D.
|
Posted By: jpbro
Date Posted: 18 September 2009 at 5:54pm
Thanks Mark.
Fixed: Hyperlinks no longer respond to only MouseUp TreeView expand/collapse glyphs no longer respond to only MouseUp
ToDo: GroupRow expand/collapse glyphs respond to only MouseUp GroupRow expand/collapse toggles selection (unless there is a good reason why this should happen??)
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: mdoubson
Date Posted: 18 September 2009 at 5:56pm
try group row now plese - get fresh update
------------- Mark Doubson, Ph.D.
|
Posted By: jpbro
Date Posted: 18 September 2009 at 6:03pm
All of the MouseUp issues appear to be corrected as far as I have tested...Thanks a lot Mark.
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: mdoubson
Date Posted: 18 September 2009 at 6:07pm
A little comment about hyperlink case - this is a weak case as you can MouseDown on one hyperlink and MouseUp on another hyperlink (inside same cell) and hyperlink (based on MouseUp) will be fired
------------- Mark Doubson, Ph.D.
|
Posted By: jpbro
Date Posted: 18 September 2009 at 6:12pm
Back to the original subject of this thread - for anyone who is
interested, here is the most recent drag selection class (works best
with most recent build of the ReportControl):
uploads/20090918_180716_RcDragSelector.zip - uploads/20090918_180716_RcDragSelector.zip
REMEMBER: In order to use this source code, you will have to download a separate timer class (I don't have permission to publicly redistribute the source code). The timer class is available here:
http://vb.mvps.org/samples/snatch.asp?id=TimerObj - http://vb.mvps.org/samples/snatch.asp?id=TimerObj
Just add the CTimer.cls and modTimer.bas files to the project (or substitute your own favourite timer class...you could even modify it to use a VB6 timer control).
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|
Posted By: mdoubson
Date Posted: 18 September 2009 at 6:26pm
Jason - what's about markup case http://forum.codejock.com/forum_posts.asp?TID=14983&PID=53191#53191 - http://forum.codejock.com/forum_posts.asp?TID=14983&PID=53191#53191
retesting under current ocx?
------------- Mark Doubson, Ph.D.
|
|