Results 1 to 5 of 5

Thread: UI Issues

  1. #1
    Join Date
    Sep 2016
    Posts
    214

    UI Issues

    Very nice work with the new UI system! I requested something like this a long while back and never expected something so powerful to be available to users. I've noticed a few small issues:

    1. As far as I can tell, fontStyle="BoldItalic" does not work on Text. It seems to simply revert to normal text.

    2. Toggle does not seem to be resizable. I have tried changing the width and height properties, but it seems to always be the same size.

    3. RESOLVED: Cannot access a UI element via scripting if the UI is attached to an object. For example, if I have a custom UI defined as custom_object.xml with an element with an id="dropDownList" and I try to call UI.setAttribute("dropDownList", "active", true) from custom_object.ttslua, it does nothing. If you have the same id defined in Global.xml, though, then it will successfully change the attribute.

    RESOLVED:
    Quote Originally Posted by Knil View Post
    To edit an objects UI you need to access the UI field on that object obj.UI.setAttribute()
    4. RESOLVED: Cannot use Global.call from a function called from a UI function. For example, I often use
    Code:
    if Global.call('checkControlPanelPrivileges', {sColor = sPlayer}) == false then return end
    which calls my global function to check if the person that pushed the button has privileges. This works fine with a button created from code, but from an XML-defined UI I get this error:
    Code:
    C:\Users\<user>\.atom\packages\tabletopsimulator-lua\lib\tabletopsimulator-lua.coffee:2405 Error in Script (Control Panel p. 1 - 45460c) function <toggleDropDown>: Object reference not set to an instance of an objectObject reference not set to an instance of an object
    handleMessage @ C:\Users\<user>\.atom\packages\tabletopsimulator-lua\lib\tabletopsimulator-lua.coffee:2405
    C:\Users\<user>\.atom\packages\tabletopsimulator-lua\lib\tabletopsimulator-lua.coffee:2405 Error in Script (Control Panel p. 1 - 45460c) function <call/checkControlPanelPrivileges>: chunk_1:(2483,4-41): cannot access field  of userdata<LuaGlobalPlayer>chunk_1:(2483,4-41): cannot access field  of userdata<LuaGlobalPlayer>
    RESOLVED: This was my misunderstanding. The player that is passed in the onClick parameters is the actual LuaPlayer reference, when I was expecting a string color like with the Lua buttons. Once I corrected this, I no longer had an issue.

    5. Button icons do not work if the UI is attached to an object. Using the same UI in Global correctly displays the icons.

    WORK-AROUND: set the icon in the onLoad() method of the object.

    6. When changing between different states of a stated object, any changes made to the UI in onLoad() don't seem to work. This makes it a bit more difficult to modify the UI dynamically, since it will reset each time you change states. Un-stated objects work just fine. Even when saving/loading, the onLoad() method can update the UI elements before they are seen.

    7. Tool-tips don't seem to work for UIs attached to objects.

    In case you are curious what I'm trying to do, I'm trying to localize my control panel. In the onLoad(), I am setting the text of various elements based on the current language setting.
    Last edited by Sancho; 07-15-2018 at 06:24 AM.

  2. #2
    Join Date
    Jan 2014
    Posts
    979
    To edit an objects UI you need to access the UI field on that object obj.UI.setAttribute()

  3. #3
    Join Date
    Sep 2016
    Posts
    214
    Quote Originally Posted by Knil View Post
    To edit an objects UI you need to access the UI field on that object obj.UI.setAttribute()
    Thank you, Knil I marked #3 resolved.

  4. #4
    Join Date
    Sep 2016
    Posts
    214
    I found a work-around for problem #5. Simply set the icon attributes in the onLoad() method of the object and they will appear. Would still be nice if this was resolved, but I'm happy with the work-around.

  5. #5
    Join Date
    Sep 2016
    Posts
    214
    I consolidated the list in the original post and added a #6. I also marked #4 resolved, which was my fault all along.

Similar Threads

  1. Hot Seat Issues
    By urenoiro in forum Scripting
    Replies: 5
    Last Post: 06-14-2018, 05:27 PM
  2. [SUPPORT] sound issues in tts
    By gajeel in forum Technical Support
    Replies: 0
    Last Post: 08-09-2017, 12:39 PM
  3. [SOLVED] IRC issues?
    By WarBeer in forum Technical Support
    Replies: 6
    Last Post: 05-18-2016, 03:51 PM
  4. [SOLVED] Mistfall DLC issues
    By Karl in forum Mistfall
    Replies: 2
    Last Post: 12-23-2015, 10:22 AM
  5. [SOLVED] Model Issues
    By Jbdevery in forum Technical Support
    Replies: 8
    Last Post: 11-13-2015, 10:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •