Apache OpenOffice (AOO) Bugzilla – Issue 111176
Selection change event of worksheet does not work well when the prompt a messagebox in the event
Last modified: 2017-05-20 11:29:46 UTC
Selection change event of worksheet does not work well when the prompt a messagebox in the event, I think because sc fire the selection change event when mouse click down. I don't have a solution yet. Please try the test sample file.
Created attachment 69137 [details] Test sample for this issue
ah this sounds familiar, the problem is the listener fires selection change events while the button is pressed down. It should be easy enough to fix, you need to modify the ScTabViewEventListener ( in sc/source/ui/unoobj/viewuno.cxx ) to only fire the selection change event when the mouse button is released. The listener already gets mouse pressed and release events so it should be easy enough to detect the start of a selection event ( e.g getting selectionChanged while the mouse button is down ) and then delay firing of the selection changed event until the mouse button is released. Can you have a look?
yes, sure. I'll take a look.
Created attachment 69155 [details] Fix patch for this issue
just looking at the patch it seems that you will trigger a selection change event when releasing the mouse button *always*. I didn't test this patch but it looks like ( from the code ) that if there was a pre-existing selection and you pushed the mouse button you *might* get a selection change event for for the old selection. Also it looks like if you push/release the button you will get a selection change event even if no selection change took place. It seems to me that you need to track whether a selection change event really occurred ( when releasing the button ) e.g have a state mbselectionChangeOccured that you use to decide when to trigger the change event. I think the logic for forwarding the event should be something like.. 1. when you detect a button press, clear mbselectionChangeOccured 2. when you get a selection change event from the listener set mbselectionChangeOccured 3. when you detect a button release if bselectionChangeOccured then forward the change event to the vba listener of course beware, all the above is untested and just my impression from looking at the code ( but I think it it closer to what we need ) what do you think?
Created attachment 69161 [details] New patch according to noel's comments
patch looks good, the only question I would have is if flag bDelaySelectionEvent is really needed? I guess looking at the code its possible to get the selection changed event *after* the mouse button is released? is that why the extra flag is there?
Because selection change event should be triggered until released left button of mouse, but the event should be triggered once pressed right button of mouse. So I add the variable bDelaySelectionEvent
> but the event should be triggered once pressed right button of mouse oh really? I didn't know that, great work then, patch looks perfect then
Looks like a From Symphony issue?
Reset assigne to the default "issues@openoffice.apache.org".