Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    MenuItem with MenuItemIfFunction needs markForRedraw to show changed state

    Hello,

    We have this case where we have an IconMenuButton with a contained Menu which has a bunch of MenuItems. Those have an MenuItemIfFunction which dynamically toggles the disabled state of the menu items.

    It seems we need to manually mark the Menu for redraw to have the correct state appearing, for instance from disabled to enabled. Is this expected? We would expect the redraw to happen when needed from inside the framework?

    We are using v9.1p_2014-12-11/Pro Deployment (built 2014-12-11).


    thanks
    jan

    #2
    Automatically handling completely arbitrary state change would require monitoring every JavaScript variable on the page, right? So no, it's not automatic, a redraw or re-show is generally required (per docs).

    Comment


      #3
      Okey, the MenuItemIfFunction which only serves one purpose of enabling/disabling a menu item seems hardly arbitraty to me but now worries - we'll implement it ourselves.

      Thanks for the feedback.

      Comment


        #4
        Again, it is re-evaluated on show and redraw, per docs.

        You seem to expect it to be re-evaluated more often, but haven't said when, and there's no means of automatically detecting that some state that your function depends on has changed.

        Comment


          #5
          Yes, it's on a simple show (clicking the button which expands the button) - nothing special. Here's the stack:

          Code:
          execute_264 (SilkMenuItemIfFunction.java:33)
          (anonymous function) (MenuItem.java:501)
          apply_139 (Impl.java:290)
          entry0 (Impl.java:347)
          (anonymous function) (Impl.java:93)
          isc_Menu_setDynamicItems (ISC_Grids.js?sv…NIQUE_KEY:2772)
          isc_Menu_show (ISC_Grids.js?sv…NIQUE_KEY:2745)
          isc_IconMenuButton_showMenu (ISC_Foundation.…UNIQUE_KEY:590)
          isc_IconMenuButton_menuIconClick (ISC_Foundation.…UNIQUE_KEY:590)
          isc_Canvas__firePartEvent (ISC_Core.js?sv=…NIQUE_KEY:2247)
          isc_Canvas_firePartEvent (ISC_Core.js?sv=…NIQUE_KEY:2247)
          isc_StatefulCanvas_handleClick (ISC_Foundation.…UNIQUE_KEY:226)
          isc_c_EventHandler_bubbleEvent (ISC_Core.js?sv=…NIQUE_KEY:1260)
          isc_c_EventHandler_handleClick (ISC_Core.js?sv=…NIQUE_KEY:1136)
          isc_c_EventHandler__handleMouseUp (ISC_Core.js?sv=…NIQUE_KEY:1127)
          isc_c_EventHandler_handleMouseUp (ISC_Core.js?sv=…NIQUE_KEY:1119)
          isc_c_EventHandler_dispatch (ISC_Core.js?sv=…NIQUE_KEY:1292)
          (anonymous function) (VM4354:3)
          When it is expanded and I go over the items with the mouse the state shows correct (eg goes from greyed out to black/regular).

          tx

          Comment


            #6
            We're not sure what this is intended to mean - you seem to be showing that your function is invoked when the menu is shown. That's what's expected and documented.

            Comment


              #7
              Well I intend to illustrate that our function is executed on show, as you indicated - no problem there.

              Again we would expect it to trigger a redraw of the menu (item) automatically when needed based on the outcome of the function (executed on show) - since toggling of enabled state is the exact purpose of the 'if function'.

              Comment


                #8
                The point of running your function on show is indeed to determine whether the menu needs to be redrawn, and in our tests, the menu is indeed automatically redrawn to reflect whatever your function returned.

                If you're seeing something different, try creating a standalone test case that replicates the problem.

                Comment

                Working...
                X