altering the contextmenu, when vtourskin.xml is active [solved]

  • again lost in peril... (on krpano 1.19pr5)

    i just ran into problems changing the contextmenu,
    when i have included the standard vtourskin.xml

    having this in one of my xmls

    Code
    <contextmenu fullscreen="false" />


    does not change the context menu at all.


    next try was this:

    Code
    <action name="contextmenu_init" autorun="preinit">
     for(set(i,0), i LT contextmenu.item.count, inc(i), set(contextmenu.item[get(i)].visible, false) );
    	</action>


    which works, but strangely still does NOT remove the Fullscreen item.

    ofc i could modify the vtourskin.xml,
    but i rather leave it as it is and work only with overrides in my xmls.

    anybody with a solution for this?

    for me it looks like the contextmenu property fullscreen does not have an effect,
    if there is still an item with name fs present.

    ps.
    i also tried removearrayitem(), but it seems that this is only supported in js.

    so, as a side question... is there a way to remove an array item with action code?

  • Hi,

    the caption=KRPANO and caption=FULLSCREEN are special items, their visible setting can not be changed.

    That means it would be necessary to remove the items - here two possibilities:

    Set the name of an array item to 'null' to remove to it:

    Code
    <action name="contextmenu_init" autorun="preinit">
      loop(contextmenu.item.count GT 0, set(contextmenu.item[0].name, null); );
    </action>

    or use the removearrayitem function:

    Code
    <action name="contextmenu_init" autorun="preinit">
      loop(contextmenu.item.count GT 0, contextmenu.item.removearrayitem(0), null); );
    </action>

    Btw - editing the vtourskin.xml itself would be also no problem of course.

    Best regards,
    Klaus

  • thanks for the fast support, klaus!

    this works now: (i didn't catch the array "prototype" functions, my bad)
    interesting that it doesn't work when using contextmenu.item.count directly in the for() condition.

    copy(j, contextmenu.item.count);
    for(set(i,0), i LT j, inc(i), contextmenu.item.removearrayitem(0) );

    anyway, for clearing all this is even simpler:

    set(contextmenu.item.count, 0);

    -----

    by the way...
    shouldnt this this ignore the font and use the native menu?

    <contextmenu native="true" customstyle="MYFONT|....." [size=10]/>

  • interesting that it doesn't work when using contextmenu.item.count directly in the for() condition.

    copy(j, contextmenu.item.count);
    for(set(i,0), i LT j, inc(i), contextmenu.item.removearrayitem(0) );

    That code should work too...

    anyway, for clearing all this is even simpler:

    set(contextmenu.item.count, 0);

    haha, of course - that's the even better solution *wink*

    shouldnt this this ignore the font and use the native menu?

    The native setting is a Flashplayer setting!

    Best regards,
    Klaus

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!