bugGNU Octave - Bugs: bug #44748, Mouse click callbacks of a...


bug #44748: Mouse click callbacks of a 'listbox' uicontrol

Submitter:  Guillaume <gyom>
Submitted:  Mon 06 Apr 2015 06:02:36 PM UTC
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  lostbard
Originator Name:  Guillaume Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Fri 11 Nov 2016 08:32:07 PM UTC, comment #18: 

MArking as fixed and closed

John Donoghue <lostbard>
Group Member
Sun 06 Nov 2016 12:55:49 PM UTC, comment #17: 
John Donoghue <lostbard>
Group Member
Mon 31 Oct 2016 04:31:05 PM UTC, comment #16: 

Where to push it is not my call (I'd vote for stable!) but given that the 4.2 release is imminent, I guess it could be now pushed to default?

Guillaume <gyom>
Thu 20 Oct 2016 11:37:39 AM UTC, comment #15: 

good - as I said in comment #8, with the number of changes in it, it should probably be pushed to default rather than stable.

Unless anyone else thinks benign enough for stable?

John Donoghue <lostbard>
Group Member
Thu 20 Oct 2016 09:15:33 AM UTC, comment #14: 

Everything works now - that's brilliant! Thank you John for writing this patch.

Guillaume <gyom>
Wed 19 Oct 2016 08:06:14 PM UTC, comment #13: 

Updated patch

(file #38769)

John Donoghue <lostbard>
Group Member
Mon 17 Oct 2016 03:08:59 PM UTC, comment #12: 

That's easy to change at least

John Donoghue <lostbard>
Group Member
Mon 17 Oct 2016 02:00:12 PM UTC, comment #11: 

Comparing listbox uicontrol between Octave and Matlab, I observe something else: if you use the code of the original submission and left-click below the 'dddddd' line (ie not on one of the four elements), Octave will do nothing while Matlab will make the last element (ie 'dddddd') selected and trigger a callback each time you click.

Guillaume <gyom>
Mon 17 Oct 2016 10:56:35 AM UTC, comment #10: 

John, sorry I could only try your fix today. It seems to work as expected - which is fantastic as it makes these uicontrols usable for real applications. Thank you so much.

I only notice one thing concerning right click: the selected item changes to the one clicked upon while it only displays the contextual menu in Matlab.

Guillaume <gyom>
Fri 14 Oct 2016 05:52:32 PM UTC, comment #9: 

Updated to also fix the popupmenu

(file #38733)

John Donoghue <lostbard>
Group Member
Fri 14 Oct 2016 05:36:07 PM UTC, comment #8: 

This (attached) appears to work for me for the listbox - not sure if I like the solution, but runs ok in fedora and win10.

I'm not sure if it has enough changes to it that should be pushed to default rather than stable ?

(file #38732)

John Donoghue <lostbard>
Group Member
Fri 14 Oct 2016 11:51:44 AM UTC, comment #7: 

I had forgotten all about this - I'll take a look again

John Donoghue <lostbard>
Group Member
Fri 14 Oct 2016 11:17:57 AM UTC, comment #6: 

John, your earlier patch was great at enabling to trigger a callback on already selected items but had the drawback of triggering the callback twice (for the single selection mode). Would you know how to fix that? This bug really prevents from using listbox uicontrols so far.

Guillaume <gyom>
Wed 27 May 2015 01:37:56 AM UTC, comment #5: 

I take that back - in single selection mode, it is firing 2x, for multiselect, only once.

John Donoghue <lostbard>
Group Member
Mon 25 May 2015 09:19:37 PM UTC, comment #4: 

I didnt appear to be triggering 2x for me on fedora, but I will check again.

I hadnt checked Windows yet.  What OS are you running.

If I remember correctly, what keys/action occur on different key/mouse events can vary depending on settings of the window manager, so maybe I have differnt settings - something else to have to handle in the code.

John Donoghue <lostbard>
Group Member
Sat 23 May 2015 12:06:26 PM UTC, comment #3: 

Thanks for looking into this John, it's very much appreciated - these changes are important to have an usable GUI.

With your patch, it is now possible to trigger a callback when clicking on an already selected item, which is great! When you click on a non-yet selected item, the callback is triggered twice: once when the new item gets selected then when releasing the left click - in MATLAB, you only trigger the callback once when releasing the click. Middle and right click behaviour are unchanged.

Guillaume <gyom>
Fri 22 May 2015 05:07:08 PM UTC, comment #2: 

How about this?

(file #34080)

John Donoghue <lostbard>
Group Member
Wed 15 Apr 2015 03:51:44 PM UTC, comment #1: 

I'm trying to look at this, starting in libgui/graphics/ListBoxControl.cc, however I guess the fix would take place somewhere else as there is something similar with a "popupmenu":

F = figure;
H = uicontrol(F,...

ie when an element is already selected, selecting it again doesn't trigger a callback (which means that the only way to trigger a callback corresponding to "aaaa", it is first required to select another item (which will trigger its own callback as well)).

Guillaume <gyom>
Mon 06 Apr 2015 06:02:36 PM UTC, original submission:  

F = figure;
H = uicontrol(F,...
    'Position',[0.05 0.05 0.9 0.9],...
C = uicontextmenu('Parent',F);
uimenu('Label','Do something', 'Parent',C,'Callback','disp(''menu'')');

With this figure, MATLAB behaviour is:

  • callback triggered only on key-up of left click, even if item already selected.

  (in Octave, if an item is already selected, a click on it does not trigger callback)

  • nothing happens with middle click.
  • right click dislays contextual menu but does not trigger callback nor change the selected item.
Guillaume <gyom>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #38769:  click3.patch added by lostbard (6KiB - application/octet-stream)
file #38733:  listbox_event2.patch added by lostbard (5KiB - application/octet-stream)
file #38732:  listbox_event.patch added by lostbard (4KiB - application/octet-stream)
file #34080:  bugfix44748.patch added by lostbard (3KiB - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by lostbard (Updated the item)
  • -email is unavailable- added by gyom (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.


    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-11-11 lostbard StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2016-11-06 lostbard StatusPatch Submitted Ready For Test
    2016-10-20 lostbard StatusNone Patch Submitted
        Assigned toNone lostbard
    2016-10-19 lostbard Attached File- Added click3.patch, #38769
    2016-10-14 lostbard Attached File- Added listbox_event2.patch, #38733
    2016-10-14 lostbard Attached File- Added listbox_event.patch, #38732
    2015-05-22 lostbard Attached File- Added bugfix44748.patch, #34080

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code