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

 
 

bug #50369: FLTK uimenu position inconsistent

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

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 25 Aug 2021 09:17:23 PM UTC, comment #13: 

just for the record in case anyone comes back caring about the 2nd part of the bug, attached is a graphic showing the output and that the qt behavior matches matlab while fltk and (unsurpisingly) gnuplot do not. regarding the findall output, as of 6.3.0:

Matlab 2021a:

hm =

  135×1 Menu array:

  Menu    (figMenuHelp)
  Menu    (figMenuWindow)
  Menu    (figMenuDesktop)
  Menu    (figMenuTools)
  Menu    (figMenuInsert)
  Menu    (figMenuView)
  Menu    (figMenuEdit)
  Menu    (figMenuFile)
  Menu    (menu1)
  Menu    (figMenuHelpPatents)
  Menu    (figMenuHelpTerms)
  Menu    (figMenuHelpPrintingExport)
  Menu    (figMenuHelpAnnotatingGraphs)
  Menu    (figMenuHelpPlottingTools)
  Menu    (figMenuHelpGraphics)
  Menu    (winMenuBlank11)
  Menu    (winMenuBlank10)
  Menu    (winMenuBlank9)
  Menu    (winMenuBlank8)
  Menu    (winMenuBlank7)
  Menu    (winMenuBlank6)
  Menu    (winMenuBlank5)
  Menu    (winMenuBlank4)
  Menu    (winMenuBlank3)
  Menu    (winMenuBlank2)
  Menu    (winMenuBlank1)
  Menu    (figMenuToolsDS)
  Menu    (figMenuToolsBF)
  Menu    (figDataManagerBrushTools)
  Menu    (figMenuToolsAlignDistrib)
  Menu    (figMenuToolsAlign)
  Menu    (figMenuToolsAlignDistributeTool)
  Menu    (figMenuToolsAlignDistributeSmart)
  Menu    (figMenuViewGrid)
  Menu    (figMenuSnapToGrid)
  Menu    (figMenuEditPinning)
  Menu    (figMenuOptions)
  Menu    (figMenuResetView)
  Menu    (figLinked)
  Menu    (figBrush)
  Menu    (figMenuDatatip)
  Menu    (figMenuRotate3D)
  Menu    (figMenuPan)
  Menu    (figMenuZoomOut)
  Menu    (figMenuZoomIn)
  Menu    (figMenuToolsPlotedit)
  Menu    (figMenuInsertLight)
  Menu    (figMenuInsertAxes)
  Menu    (figMenuInsertEllipse)
  Menu    (figMenuInsertRectangle)
  Menu    (figMenuInsertTextbox)
  Menu    (figMenuInsertArrow2)
  Menu    (figMenuInsertTextArrow)
  Menu    (figMenuInsertArrow)
  Menu    (figMenuInsertLine)
  Menu    (figMenuInsertColorbar)
  Menu    (figMenuInsertLegend)
  Menu    (figMenuInsertTitle)
  Menu    (figMenuInsertZLabel)
  Menu    (figMenuInsertYLabel)
  Menu    (figMenuInsertXLabel)
  Menu    (figMenuPropertyEditor)
  Menu    (figMenuPlotBrowser)
  Menu    (figMenuFigurePalette)
  Menu    (figMenuPropertyInspector)
  Menu    (figMenuPloteditToolbar)
  Menu    (figMenuCameraToolbar)
  Menu    (figMenuFigureToolbar)
  Menu    (figMenuEditClearWorkspace)
  Menu    (figMenuEditClearCmdHistory)
  Menu    (figMenuEditClearCmdWindow)
  Menu    (figMenuEditClearFigure)
  Menu    (figMenuEditFindFiles)
  Menu    (figMenuEditColormap)
  Menu    (figMenuEditGCO)
  Menu    (figMenuEditGCA)
  Menu    (figMenuEditGCF)
  Menu    (figMenuEditCopyOptions)
  Menu    (figMenuEditCopyFigure)
  Menu    (figMenuEditSelectAll)
  Menu    (figMenuEditDelete)
  Menu    (figMenuEditClear)
  Menu    (figMenuEditPaste)
  Menu    (figMenuEditCopy)
  Menu    (figMenuEditCut)
  Menu    (figMenuEditRedo)
  Menu    (figMenuEditUndo)
  Menu    (figMenuFileExitMatlab)
  Menu    (printMenu)
  Menu    (figMenuFilePrintPreview)
  Menu    (figMenuFileExportSetup)
  Menu    (figMenuFilePreferences)
  Menu    (figMenuFileSaveWorkspaceAs)
  Menu    (figMenuFileImportData)
  Menu    (figMenuGenerateCode)
  Menu    (figMenuFileSaveAs)
  Menu    (figMenuFileSave)
  Menu    (figMenuFileClose)
  Menu    (figMenuOpen)
  Menu    (figMenuUpdateFileNew)
  Menu    (figDataManagerCopy)
  Menu    (figDataManagerPaste)
  Menu    (figDataManagerNewVar)
  Menu    (figDataManagerRemoveUnbr)
  Menu    (figDataManagerRemove)
  Menu    (figDataManagerColor)
  Menu    (figDataManagerBrush)
  Menu    (figMenuToolsDistributeHRight)
  Menu    (figMenuToolsDistributeHCent)
  Menu    (figMenuToolsDistributeHLeft)
  Menu    (figMenuToolsDistributeHAdj)
  Menu    (figMenuToolsDistributeVBot)
  Menu    (figMenuToolsDistributeVMid)
  Menu    (figMenuToolsDistributeVTop)
  Menu    (figMenuToolsDistributeVAdj)
  Menu    (figMenuToolsAlignBottom)
  Menu    (figMenuToolsAlignMiddle)
  Menu    (figMenuToolsAlignTop)
  Menu    (figMenuToolsAlignRight)
  Menu    (figMenuToolsAlignCenter)
  Menu    (figMenuToolsAlignLeft)
  Menu    (figMenuOptionsDataBar)
  Menu    (figMenuOptionsDatatip)
  Menu    (figMenuOptionsYPan)
  Menu    (figMenuOptionsXPan)
  Menu    (figMenuOptionsXYPan)
  Menu    (figMenuOptionsYZoom)
  Menu    (figMenuOptionsXZoom)
  Menu    (figMenuOptionsXYZoom)
  Menu    (figMenuFileNewVariable)
  Menu    (figMenuFileNewModel)
  Menu    (figMenuNewFigure)
  Menu    (figMenuFileNewScript)
  Menu    (figDataManagerReplaceConst)
  Menu    (figDataManagerReplaceNaN)



and set(gcf, 'menubar', 'none') hides all but the 'menu1' item.

in Octave 6.3.0, qt toolkit:


>> hm = findall(gcf, 'type', 'uimenu')
hm =

  -48.934
  -76.472
  -82.266
  -87.588
  -71.841
  -72.283
  -73.269
  -74.049
  -75.972
  -77.484
  -78.452
  -79.415
  -80.790
  -81.777
  -83.600
  -84.242
  -85.749
  -86.329
  -64.813
  -65.119
  -66.463
  -67.958
  -68.470
  -69.710
  -70.844


and set(gcf, 'menubar', 'none') also hides all but the menu1 item as expected.

so other than whether or not the findall output is compatible, at least the uimenu behavior seems correct.


Nicholas Jankowski <nrjank>
Group Member
Wed 25 Aug 2021 12:13:48 PM UTC, comment #12: 

I agree with Rik, and I'll close this report as won't fix.

Pantxo Diribarne <pantxo>
Group Member
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>
Group 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>
Group 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>
Group 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

    '&Help'
    '&Window'
    '&Desktop'
    '&Tools'
    '&Insert'
    '&View'
    '&Edit'
    '&File'
    'Pate&nts'
...


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>
Group 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:


h=figure;
get(uimenu('label','menu'),'position')
findall(h)


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>
Group 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>
Group 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>
Group 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>
Group 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);
uimenu('label','menu1','position',1);

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);
uimenu('label','menu1','position',1);

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

graphics_toolkit ('fltk');
uimenu('label','menu1','position',1);

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:
   
   
Comment:
   

Attached Files
file #51817:  uimenu_comparisons.png added by nrjank (90KiB - image/png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by nrjank (Updated the item)
  • -email is unavailable- added by pantxo (Posted a comment)
  • -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)
  •  

    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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-08-25 nrjank Attached File- Added uimenu_comparisons.png, #51817
    2021-08-25 pantxo StatusConfirmed Wont Fix
        Open/ClosedOpen Closed
    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.13-4448.
    Corresponding source code