Hiding Menu Items

  1. 3 months ago

    Graham B

    Mar 9 Pre-Release Testers, Xojo Pro The Canada's

    Having a problem on Windows when hiding a menu item, setting it to visible = false.
    The style of the menu changes.

    from

    -image-

    to

    -image-

    Removing them is fine but i don't want to have to add and remove the items.

    I have sent in a feedback, but i was wondering if anyone knows how to hide a menu item on windows without this happening.

    If i set an item invisible on window open, app open, window enablemenustates events, they all cause the problem.
    Happens on Xojo 2016r3, 2017r2.1 and 2017r3, compiled on OSX for Windows.

  2. Tim P

    Mar 9 Pre-Release Testers, XDC Speakers

    Per the documentation, the Visible property is not available on Windows. This is expected.

    Because the Windows paradigm allows different windows to have different menubars you can use different menubars on Windows when certain items aren't relevant.

    I try to aim for one menubar, and removing platform specific items in App.Open. Doing it here prevents a situation where the removal might occur twice and the second time would cause a NilObjectException.

  3. Graham B

    Mar 9 Pre-Release Testers, Xojo Pro The Canada's
    Edited 3 months ago

    If the property is not available on windows why does it still hide the menu item? (and change the look and feel of the menu bar)

    -image-

  4. Tim P

    Mar 9 Pre-Release Testers, XDC Speakers

    @Graham B If the property is not available on windows why does it still hide the menu item? (and change the look and feel of the menu bar)

    All I can tell you the docs state that it's not available. I misunderstood your post the first time I read it.
    http://docs.xojo.com/index.php/MenuItem.Visible

    But now that I do understand it sounds like you're having an issue with an unsupported property.

  5. Christian S

    Mar 9 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    Xojo rebuilds the menu for you without the invisible ones.
    And the rebuild menu is in older style.

  6. Graham B

    Mar 9 Pre-Release Testers, Xojo Pro The Canada's

    So the only way around this would be to remove the menu item, keeping a local property to stop the menu item being cleaned up, and then inserting it back in when it needs to be shown.

  7. Christian S

    Mar 9 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    No, you could have two menu bars and switch between them by assigning window.menubar property.

  8. Tim P

    Mar 9 Pre-Release Testers, XDC Speakers
    Edited 3 months ago

    @Graham B So the only way around this would be to remove the menu item, keeping a local property to stop the menu item being cleaned up, and then inserting it back in when it needs to be shown.

    I would say that's a terribly confusing user experience. You should not modify a menus items once they're presented to the user. Enabling and disabling as necessary, sure. But removing and adding adds to confusion, and means they can't locate items easily.

    There is an alternative way of swapping menubars on the fly, but then you'll have different menubar objects in your project for different states of the menus. I don't recommend the alternative, but it's available.

    Edit: Beaten by just a few seconds! I included my opinion on how you're handling the menus though.

  9. Graham B

    Mar 9 Pre-Release Testers, Xojo Pro The Canada's

    We have a lot of menu items, having two menus (would actually have to be 4 to support the preference driven options) would be a nightmare to code the handlers against.

    Hiding and showing menu's is only down based on preferences or current registrations, it's not happening constantly. Not sure why you are saying it such a bad item, don't Microsoft automatically hide menu items in office? that being said that was awful.

    I think adding and removing them is the only way to go, as there are only a few items to manage.

  10. Michel B

    Mar 9 Pre-Release Testers RubberViews.com

    You can also disable them.

  11. Jeff T

    Mar 9 Midlands of England, Europe

    How about change the text to "-" making them into separators?

  12. Christian S

    Mar 10 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    A good menu shows all the items and only disables what is currently not available.

    Only if you switch from one part of the app to another, e.g. from spreadsheet to word processor in Office app, you get a new menu.

  13. Markus W

    Mar 10 Pre-Release Testers, Xojo Pro #JeSuisHuman Germany, Heidelb...

    @ChristianSchmitz Xojo rebuilds the menu for you without the invisible ones.
    And the rebuild menu is in older style.

    Isn't that what's usually called a bug? And therefore he should open a feedback report?

  14. Christian S

    Mar 10 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    of course @Graham B could report the behavior as a bug/problem.

    But if Windows doesn't allow to hide existing menu items and you need to rebuild the menu, it could be called a bug to use older style.

  15. Michel B

    Mar 10 Pre-Release Testers RubberViews.com

    AFAIK you can hide menuitems in the enableMenuItem event only.

  16. Markus W

    Mar 10 Pre-Release Testers, Xojo Pro #JeSuisHuman Germany, Heidelb...

    Btw what happens if you set MenuItem.Enabled as well? See bug report Feedback Case #33462

  17. Emile S

    Mar 10 Europe (France, Strasbourg)
    Edited 3 months ago

    I just set a MenuItem as disabled (in App.EnableMenuItem) because the feature is not "public" ready.

    Works fine on macOS (appears disabled), but I do not have a Windows machine handly (now) to test it, yet.

    Edit: typo.

  18. Anthony C

    Mar 10 Pre-Release Testers, Xojo Pro GraffitiSuite Developer
    Edited 3 months ago

    I've got to get out my pitchfork here. Swapping menus around (hiding/showing/removing) on Windows windows (windows windows windows) is just a terrible thing.

    As others have said, it creates a confusing interface for users. The proper way is always to Enable/Disable. It's better that a user question why the item is disabled and look for an answer, than realize what they're looking for has just magically disappeared with no reason. At that point they can lose trust in the UI.

  19. Anthony C

    Mar 10 Pre-Release Testers, Xojo Pro GraffitiSuite Developer
    Edited 3 months ago

    That said, this does appear to be a bug, and the discussion isn't about UI best practices. I would report this issue in Feedback.

  20. Julian S

    Mar 10 Pre-Release Testers, Xojo Pro UK

    The only way is to Clone it into a temporary MenuItem then Remove it and Insert it back in when you want it shown. That is the way its done according to MSDN, there is no hide flag in windows.

    Seems odd that the framework doesn't just wrap all that up for you or they tried and found a problem and just left it where it was producing that odd looking menu.

  21. Newer ›

or Sign Up to reply!