bugGNU Octave - Bugs: bug #49529, set(gcf, "menubar",...

 
 

bug #49529: set(gcf, "menubar", "figure") does not restore figure menu bar

Submitter:  -X- <jsh>
Submitted:  Thu 03 Nov 2016 06:27:23 PM UTC
   
 
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 4.2.0-rc3 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 10 Nov 2016 05:32:56 AM UTC, comment #14: 
Rik <rik5>
Group administrator
Wed 09 Nov 2016 12:42:33 PM UTC, comment #13: 

I attached the new patch.

I used both the scripts from comment #10 and comment #9 for testing but feel free to play again with the order in which custom menus are added/set visible/... This resizing mechanism is surprisingly complicated: sort of a state machine which can't really track its state.

(file #38913)

Pantxo Diribarne <pantxo>
Group Member
Wed 09 Nov 2016 07:01:24 AM UTC, comment #12: 

I think I have a working solution but didn't write the log yet.

Pantxo Diribarne <pantxo>
Group Member
Tue 08 Nov 2016 11:28:49 PM UTC, comment #11: 

@Pantxo: Do you want me to go ahead and apply the patch, even though there is the outstanding issue in comment #10?  Or do you see a solution and I should wait until a full changeset is available?

Rik <rik5>
Group administrator
Fri 04 Nov 2016 05:51:44 PM UTC, comment #10: 

The patch works much better, but I found another obscure case where the window size shrinks.


close all
graphics_toolkit qt
figure
axes
mbar = uimenu ("label", "My_Menu");

keyboard;
set (mbar, 'visible', 'off')
set (gcf, 'toolbar', 'none')
set (gcf, 'menubar', 'none')
set (mbar, 'visible', 'on')  # window shrinks here by ~30 pixels


The commands need to be run one by one, so that Octave returns to the prompt after each command and updates the window.  The "keyboard" call is there just because I put this in a file tst_mbar2.m.


(file #38888)

Rik <rik5>
Group administrator
Fri 04 Nov 2016 03:45:43 PM UTC, comment #9: 

I attached an updated patch please. I used the following sequence for tests:


figure
annotation ("rectangle", [0 0 1 1], "edgecolor", "r", "linewidth", 2);
h1 = uimenu ("label", "foo", "callback", "disp (get (gcbo (), 'label'))");
h2 = uimenu ("label", "bar", "callback", "disp (get (gcbo (), 'label'))");
set(gcf,'menubar','none') # The main menubar and the toolbar dissapear, custom menus remain
set (h1, "visible", "off") # foo menu disappears
set (h2, "visible", "off") # bar menu disappears and the figure is correctly resized
set (h2, "visible", "on")  # bar menu reappears and the figure is correctly resized
set(gcf,'menubar','figure') # main menu and toolbar reappear and the figure is correctly resized
set (h1, "visible", "on") # foo menu reappears


(file #38886)

Pantxo Diribarne <pantxo>
Group Member
Fri 04 Nov 2016 03:27:25 PM UTC, comment #8: 

Here's a tiny script that I used to test.


close all
graphics_toolkit qt
figure
axes
mbar = uimenu ("label", "My_Menu");
keyboard;
set (gcf, "menubar", "none");
set (gcf, "menubar", "figure");
set (gcf, "menubar", "none");
set (gcf, "menubar", "figure");
set (gcf, "menubar", "none");
set (gcf, "menubar", "figure");


It is attached to this bug report as tst_mbar.m

The window definitely grows each time a hide/show cycle is done.




(file #38885)

Rik <rik5>
Group administrator
Fri 04 Nov 2016 09:30:43 AM UTC, comment #7: 

I spoke too soon. With the patch applied, adding custom menus to the main menubar now makes the figure larger than it should ... looks like this was the intent of the if block. I'll have a look (seriously this time) ASAP. Reopening the report.

Pantxo Diribarne <pantxo>
Group Member
Thu 03 Nov 2016 11:58:38 PM UTC, comment #6: 

I pushed your cset here (http://hg.savannah.gnu.org/hgweb/octave/rev/0cd8a1c22f23).  Thanks for that quick response.  Closing report.

Rik <rik5>
Group administrator
Thu 03 Nov 2016 10:52:41 PM UTC, comment #5: 

There is an if block that prevents hidden menubar from being restored. I really don't know what was the intent but the attached patch fixes the issue.


(file #38878)

Pantxo Diribarne <pantxo>
Group Member
Thu 03 Nov 2016 09:43:14 PM UTC, comment #4: 

Okay, I'm seeing it now.

For reference, this is with the qt toolkit.

With FLTK, the menubar can be hidden and restored, but nothing affects the toolbar.  That's a separate issue.

Rik <rik5>
Group administrator
Thu 03 Nov 2016 09:35:55 PM UTC, comment #3: 

I can confirm comment #2 here.

Mike Miller <mtmiller>
Group Member
Thu 03 Nov 2016 09:24:02 PM UTC, comment #2: 

set (gcf, 'menubar', 'none') hides both the menu and toolbar in matlab so that part works the same in octave as for matlab.

In matlab (and octave 4.0.3) set (gcf, 'menubar', 'figure') reshows the default figure menu and toolbar.

In the 4.2.0rc3, it only adds back the toolbar.


John Donoghue <lostbard>
Group Member
Thu 03 Nov 2016 09:00:53 PM UTC, comment #1: 

Do you have code that reproduces the problem?  This works for me


octave -f
graphics_toolkit qt
figure ()
set (gcf, 'menubar', 'none')


Note also that user-created uimenus are not affected by the 'menubar' property.


Figure menu bar display, specified as 'figure' or 'none'. The MenuBar property enables you to display or hide the default menus at the top of a figure window. Specify 'figure' to display the menu bar. Specify 'none' to hide it.

This property affects only default menus, and does not affect menus defined with the uimenu command.



Rik <rik5>
Group administrator
Thu 03 Nov 2016 06:27:23 PM UTC, original submission:  


It seems switching uimenu on/off is broken in the 4.2-rc (which was working before).

The command:


figure()
set(gcf,'menubar','none')


turns off both the menubar and toolbar (should only affect the menubar). Even worse


set(gcf,'menubar','figure')


does not return the menubar at all.

-X- <jsh>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #38913:  menubar4.patch added by pantxo (6KiB - text/x-diff)
file #38888:  tst_mbar2.m added by rik5 (242B - d2l/unknowntype)
file #38886:  menubar2.patch added by pantxo (3KiB - text/x-diff)
file #38885:  tst_mbar.m added by rik5 (274B - d2l/unknowntype)
file #38878:  menubar.patch added by pantxo (2KiB - text/x-diff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pantxo (Updated the item)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by lostbard (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jsh (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 21 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-11-10 rik5 StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2016-11-09 pantxo Attached File- Added menubar4.patch, #38913
    2016-11-04 rik5 Attached File- Added tst_mbar2.m, #38888
    2016-11-04 pantxo Attached File- Added menubar2.patch, #38886
    2016-11-04 rik5 Attached File- Added tst_mbar.m, #38885
    2016-11-04 pantxo StatusFixed In Progress
        Open/ClosedClosed Open
    2016-11-03 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2016-11-03 pantxo Attached File- Added menubar.patch, #38878
        StatusConfirmed Patch Submitted
    2016-11-03 rik5 Item GroupNone Regression
        Summarytoggling menubar on/off is broken set(gcf, "menubar", "figure") does not restore figure menu bar
    2016-11-03 rik5 Summarytoggling uimenu on/off is broken toggling menubar on/off is broken
    2016-11-03 rik5 Item GroupRegression None
        Summaryset(gcf, &quot;menubar&quot;, &quot;figure&quot;) does not restore figure menu bar toggling uimenu on/off is broken
    2016-11-03 mtmiller Item GroupNone Regression
        StatusWorks For Me Confirmed
        Summarytoggling uimenu on/off is broken set(gcf, "menubar", "figure") does not restore figure menu bar
    2016-11-03 rik5 StatusNone Works For Me

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code