bugGNU Octave - Bugs: bug #55428, gcbf and HandleVisibility property


bug #55428: gcbf and HandleVisibility property

Submitter:  Guillaume <gyom>
Submitted:  Wed 09 Jan 2019 01:32:23 PM UTC
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
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 Jan 2019 05:23:33 PM UTC, comment #10: 
Pantxo Diribarne <pantxo>
Group Member
Fri 11 Jan 2019 04:44:00 PM UTC, comment #9: 

Thanks, Pantxo. The patch works for me with the example from this report and I also didn't observe any side effect when testing it with a larger graphical interface.

Guillaume <gyom>
Fri 11 Jan 2019 04:00:05 PM UTC, comment #8: 

I attached a patch. If it works I'll push it together with a patch for bug #54187.

(file #45936)

Pantxo Diribarne <pantxo>
Group Member
Fri 11 Jan 2019 12:17:30 PM UTC, comment #7: 

Ok, so I'll implement this (no restriction on what object can become the root callbackobject), and to be honest it will help with bug #54187 so I'll do all this on stable.

Pantxo Diribarne <pantxo>
Group Member
Fri 11 Jan 2019 12:01:31 PM UTC, comment #6: 

If you put together "When the HandleVisibility property value is 'off', objects do not appear in the root CallbackObject property" and "gcbo returns the handle of the object whose callback is currently executing. This handle is obtained from the root property 'CallbackObject'", then you would conclude that an object with HandleVisibility set to 'off' would never be returned by gcbo.

My understanding is that, to be of any use, gcbf and gcbo would always return a non-empty object when called within a callback regardless of the HandleVisibility property.

Guillaume <gyom>
Fri 11 Jan 2019 11:07:36 AM UTC, comment #5: 

Is is me or is it in direct contradiction with the documentation which states that the root callbackobject is not changed when the figure has handlevisibility = off?

Pantxo Diribarne <pantxo>
Group Member
Fri 11 Jan 2019 09:49:16 AM UTC, comment #4: 

Thanks for looking into this, Pantxo. Clicking inside the figure in your example returns the figure object.

Guillaume <gyom>
Thu 10 Jan 2019 09:24:27 PM UTC, comment #3: 

The code mentioned in comment #1 was added as part of a fix for bug #52621. Specifically, the implementation relied on this excerpt of ML doc for "handlevisibility" figure properties [1]:

When the HandleVisibility property value is restricted using the 'callback' or 'off' settings, the object does not appear in the
parent object Children property, figures do not appear in the
root CurrentFigure property, objects do not appear in the root
CallbackObject property or in the figure CurrentObject property,
and axes do not appear in their parent CurrentAxes property.

I see now that the documentation for uimenu's "handlevisibility"  [2] does not state that gcbo/gcbf are affected. So the behavior is different for figures and other objects?
What does the following return?

hf = figure ('handlevisibility', 'off', 'buttondownfcn', 'gcbo')
% Click inside the figure

[1] https://fr.mathworks.com/help/matlab/ref/matlab.ui.figure-properties.html#buiwuyk-1-HandleVisibility
[2] https://fr.mathworks.com/help/matlab/ref/matlab.ui.container.menu-properties.html#bub8xy5-1_sep_shared-HandleVisibility

Pantxo Diribarne <pantxo>
Group Member
Thu 10 Jan 2019 02:58:11 PM UTC, comment #2: 

Yes, the same happens for 'gcbo': it contains the uimenu object of the clicked menu, whether HandleVisibility is set on or off.

Guillaume <gyom>
Thu 10 Jan 2019 02:30:13 PM UTC, comment #1: 

I think I am the one who prevented objects with "handlevisibility" == "off" from becoming the current root "callbackobject". I don't remember why, probably because of a misunderstanding of ML documentation.

This is implemented in graphics.cc (gh_manager::do_execute_callback):

          gh_manager::auto_lock guard;
          callback_objects.push_front (go);
          if (go.get ("handlevisibility").string_value () != "off")
            xset_gcbo (h);

Should "gcbo" also return the uimenu object for menu1 in your example?

Pantxo Diribarne <pantxo>
Group Member
Wed 09 Jan 2019 01:32:23 PM UTC, original submission:  

In the following example, gcbf returns [] instead of the handle of the figure when clicking on 'menu 1' (when the HandleVisibility property is set to 'off'):

h = figure ();
u = uimenu ( h, 'Label', 'Menu');
uimenu (u, 'Label', 'menu 1', 'HandleVisibility', 'off', 'CallBack', 'gcbf');
uimenu (u, 'Label', 'menu 2', 'HandleVisibility', 'on', 'CallBack', 'gcbf');
uimenu (u, 'Label', 'menu 3', 'HandleVisibility', 'callback', 'CallBack', 'gcbf');

Guillaume <gyom>


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

Attach Files:

Attached Files
file #45936:  callbackobj2.patch added by pantxo (3KiB - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by pantxo (Posted a comment)
  • -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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-01-11 pantxo StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2019-01-11 pantxo Attached File- Added callbackobj2.patch, #45936
        StatusConfirmed Patch Submitted
    2019-01-10 pantxo StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code