bugGNU Octave - Bugs: bug #50369, FLTK uimenu position inconsistent


bug #50369: FLTK uimenu position inconsistent

Submitted by:  Roland Baudin <roland65>
Submitted on:  Tue 21 Feb 2017 01:55:20 PM UTC  
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  4.2.1 Operating System:  GNU/Linux

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Fri 14 Aug 2020 11:19:05 PM UTC, comment #11: 

Is this bug important anymore?  It's filed against 4.2.1 and has'nt seen a comment since March 2017.  All development is now targeted towards the Qt toolkit.

Rik <rik5>
Project Administrator
Fri 03 Mar 2017 01:46:39 AM UTC, comment #10: 

To be an ordinary menu, I think it needs to be added at the same time the figure is created.  There is already a function that does that for FLTK in scripts/plot/util/private/__add_default_menu__.m.  It's not hard to extend it to Qt, but the choice of what goes in the menus is different.

Rik <rik5>
Project Administrator
Mon 27 Feb 2017 06:13:30 PM UTC, comment #9: 

Okay, that's something we didn't know.  The built-in menu is not particularly special, although it still needs to turn off when

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

is used, but leave any user-created uimenu items.

Rik <rik5>
Project Administrator
Mon 27 Feb 2017 12:59:59 PM UTC, comment #8: 

I removed the patch from bug #49734 that I was testing and now the menu appears at the rightmost position as expected.

Otherwise, yes, in Matlab, the built-in menus are visible from findall and can be modified/removed/etc.

>> close all
>> hf = figure;
>> hm = findall (hf, 'type', 'uimenu')

hm =

  133×1 Menu array:

  Menu    (figMenuHelp)
  Menu    (figMenuWindow)
  Menu    (figMenuDesktop)
  Menu    (figMenuTools)
  Menu    (figMenuInsert)
  Menu    (figMenuView)
  Menu    (figMenuEdit)
  Menu    (figMenuFile)
  Menu    (figMenuHelpPatents)

>> get (hm, 'label')

ans =

  133×1 cell array


Guillaume <gyom>
Fri 24 Feb 2017 05:14:41 PM UTC, comment #7: 

The answer to the first part of your question is "yes", the menu appears at the rightmost position if no "position" property is specified.  In Octave,

>> hf = figure
hf =  1
>> hm = uimenu ('label', 'mymenu');
>> get (hm, 'position')
ans =  4

The position is after the "File", "Edit", and "Help" menubar items.

As to whether findall should return uimenu items that belong to the built-in menu, that is something that should be checked in Matlab.  It is not clear from the documentation that these entries are ordinary uimenu items.  Sample code to check would be

close all
hf = figure;
hm = findall (hf, 'type', 'uimenu')
get (hm, 'label')

Run this code and see if hm is empty or not and what labels are returned.

Rik <rik5>
Project Administrator
Fri 24 Feb 2017 11:11:33 AM UTC, comment #6: 

@Rik, thanks for the change. My compiled Octave includes a patch from bug #49734 so I'm not sure I test things appropriately but what do you get with this:


I would expect the new menu to be at the right-most position and findall to return the handles of all menus (ie File/Edit/Help as well).

Guillaume <gyom>
Fri 24 Feb 2017 12:10:58 AM UTC, comment #5: 

For Qt, I checked in a change on the development branch that makes uimenu compatible with Matlab (http://hg.savannah.gnu.org/hgweb/octave/rev/73f7ef7169ac).

That still leaves the problem with FLTK.

Rik <rik5>
Project Administrator
Thu 23 Feb 2017 09:26:10 PM UTC, comment #4: 

There are two different issues here (since there is separate driver code for Qt and for FLTK).

For FLTK, the problem seems to be an off-by-1 error.  Octave uses '1' to indicate the first position, but FLTK uses '0'.  Somewehere, probably in _init_fltk_.cc the position variable needs to be decremented by 1.

For Qt, numbering works correctly but the default menu of "File Edit Help" is always placed to the left of any user-created menus.  The default menubar items need to be treated as ordinary menu items that can be mixed with the user's own uimenu items.

Rik <rik5>
Project Administrator
Thu 23 Feb 2017 07:34:31 AM UTC, comment #3: 

Oops, sorry for the mistake... Please swap leftmost and rightmost in my bug report!
Was a bit tired, I suppose...

Roland Baudin <roland65>
Thu 23 Feb 2017 01:16:53 AM UTC, comment #2: 

Also, I can confirm that FLTK will sometimes put the menu in between "File" and "Edit" and sometimes to the left of "File".

Rik <rik5>
Project Administrator
Thu 23 Feb 2017 01:13:00 AM UTC, comment #1: 

Could you attach a picture taken from Matlab so we can see what the behavior is supposed to be?  According to your last comment, "position 1 should always be the rightmost position, before all other menu items."  This doesn't make sense to me, unless you meant "leftmost".

Rik <rik5>
Project Administrator
Tue 21 Feb 2017 01:55:20 PM UTC, original submission:  

In qt graphics, the following commands place the uimenu at the leftmost position (after the File / Edit / Help menu items):

graphics_toolkit ('qt');
x=[0:0.1:2*pi]; y=sin(x);plot(x,y);

But in fltk graphics, the same commands place the uimenu between the File and Edit menu items.

graphics_toolkit ('fltk');
x=[0:0.1:2*pi]; y=sin(x);plot(x,y);

And sometimes, it also places the uimenu at the first position, like in the following case:

graphics_toolkit ('fltk');

To be consistent with MATLAB, position 1 should always be the rightmost position, before all other menu items.

Roland Baudin <roland65>


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

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by gyom (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by roland65 (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-03-03 rik5 Release4.2.0 => 4.2.1
    2017-02-24 rik5 SummaryInconsistent uimenu position between qt and fltk graphics => FLTK uimenu position inconsistent
    2017-02-23 rik5 StatusNeed Info => Confirmed
    2017-02-23 rik5 StatusNone => Need Info

    Back to the top

    Powered by Savane 3.5