conflict of names in krpano on the example of the combobox plugin

  • Hello colleagues!
    Thanks to Klaus for the great work!

    by applying this code


    I found that the combobox on my tour did not work, showing such warnings

    Code
    WARNING: Unknown action: cb.loadstyle 
    WARNING: Unknown action: cb.createarray 
    WARNING: Unknown action: layer[cb1].additem 
    
    
    WARNING: Unknown action: layer[get(cbname)].scrollarea.update


    By sequentially deleting parts of the program, I defined a module that prevented the operation of the combo box
    then I found a conflicting piece of code in this module, it turned out to be an action, counting the coordinates of the hotspot insertion
    this action is taken from the example, which is contained both in the original assembly of 1.14 pr15, and in earlier versions



    in order for the combo box to work fine, I had to change the names of the variables ch, sh, ca, sa, cb, sb

    developing very complex virtual tours, I try to make sure that there are no conflicts with the old code in the new program modules, and I succeed
    However, from time to time there are situations that are shown above
    I believe that the documentation for the krpano should have a list of reserved words etc

  • Hi,

    thanks for reporting!
    I will improve the combobox.xml to make it better independent of other existing variables.

    And here also the 'calc_pos_from_hfov_yaw_pitch_roll' action ported to local-scope usage to avoid any external conflicts:

    Best regards,
    Klaus

  • Hi,

    I tried using
    parentcopeset(variable, value)
    and I did not succeed..

    Sorry, not sure what you mean...


    and yet, what do you think about drawing up a list of reserved words?

    That would be here:
    https://krpano.com/docu/xml/#top
    https://krpano.com/docu/actions/#top

    Beside of the elements defined there, there should be no other special 'reserved words'...

    The problem in the first post was that a 'cb' named Number variable gets defined globally and in the combobox.xml also a 'cb' named variable was used, but there as Object - and when trying to save the Object into the existing and Number-typed variable, it fails and leads to the following errors.

    When all actions would use scope="local" this wouldn't happen, because then all actions would define their new variables only in their own local scope.
    But as long there are also actions without local scope there can be still problematic cases, because actions with scope="local" still have access to the global scope when a variable wasn't found in the local one. To avoid also such cases there is also the possibility to use scope="localonly" - then all variable access is limited to the local scope of the action and an unintended variable mixing or conflicts with same named variables not possible anymore.

    With the new 1.19-pr16 release I have already updated the combobox.xml plugin now to use scope="localonly" in all actions and all other krpano xml plugins and xml skin files will also get updated too over time.

    Best regards,
    Klaus

Participate now!

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