Announcement

Collapse

Forum Rules

  • No flaming or derogatory remarks, directly or through insinuation.
  • No discussion, sharing or referencing illegal software such as hacks, keygen, cracks and pirated software.
  • No offensive contents, including but not limited to, racism, gore or pornography.
  • No excessive spam/meme, i.e. copious one liners in a short period of time, typing with all caps or posting meme responses (text/image).
  • No trolling, including but not limited to, flame incitation, user provocation or false information distribution.
  • No link spamming or signature advertisements for content not specific to Dota 2.
  • No Dota 2 key requests, sell, trade etc.
  • You may not create multiple accounts for any purpose, including ban evasion, unless expressly permitted by a moderator.

  • Please search before posting. One thread per issue. Do not create another thread if there is an existing one already.
  • Before posting anything, make sure you check out all sticky threads (e.g., this). Do not create new threads about closed ones.
  • It is extremely important that you post in correct forum section.

  • Balance discussion only in Misc.
  • All art related (such as hero model) feedbacks go to Art Feedback Forum.
  • All matchmaking feedback should go here: Matchmaking Feedback
  • All report/low priority issues should go here: Commend/Report/Ban Feedback
  • No specific workshop item feedback. These should go to workshop page of that item.
  • When posting in non-bugs section (such as this), use [Bugs], [Discussion] or [Suggestion] prefix in your thread name.



In case you object some action by a moderator, please contact him directly through PM and explain your concerns politely. If you are still unable to resolve the issue, contact an administrator. Do not drag these issues in public.



All rules are meant to augment common sense, please use them when not conflicted with aforementioned policies.
See more
See less

[SUGGESTION] Custom elements

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [SUGGESTION] Custom elements

    Currently it does not seem to be possible to define your own elements from either XML or $.CreatePanel. This would be really useful for creating custom components such as TextEntry, DropDown, etc. I suggest an API call with the following signature:

    $.CreateFactory(string elementName, function constructor);

    This would create a new class with prototypical inheritance of the base Panel. After this call, the element would be globally binded to the current context and accessible for creation via XML/$.CreatePanel.

    Even if you don't follow the exact course above, exposing some way to create custom components would be very helpful. If this is already possible and have happened to miss it, please notify me.

  • #2
    I like the idea. It would tie in well with the modular philosophy that valve seems to propagate according to this wiki quote
    For example, a scoreboard may consist of a "root" XML file for the main scoreboard layout, a second "team" XML file that describes how each team is represented, and a third "player" XML file that describes how each player on each team is represented.
    It would go a long way for readability and workflow of complex UIs.

    Comment


    • #3
      Originally posted by yokatta24 View Post
      Currently it does not seem to be possible to define your own elements from either XML or $.CreatePanel. This would be really useful for creating custom components such as TextEntry, DropDown, etc. I suggest an API call with the following signature:

      $.CreateFactory(string elementName, function constructor);

      This would create a new class with prototypical inheritance of the base Panel. After this call, the element would be globally binded to the current context and accessible for creation via XML/$.CreatePanel.

      Even if you don't follow the exact course above, exposing some way to create custom components would be very helpful. If this is already possible and have happened to miss it, please notify me.
      You can modularise your code by using Panel.BLoadLayout() for now. It's not as clean as having custom XML elements, but it does the job.
      Last edited by Lattyware; 06-24-2015, 03:04 PM.

      Comment


      • #4
        I have just finished the core of a little library that provides a very neat way to define and use modules consisting of a combination of xml javascript and css. You can find the project here:

        https://github.com/Perryvw/PanoramaU...ter/Modular.js

        Example usage at the bottom of the file, contributions are welcome.
        Last edited by AgentP; 07-12-2015, 12:12 PM.

        Comment


        • #5
          Bump, was about to post a new thread, but found this one.

          Here's what I was gonna post:
          [Bug/Suggestion] Dynamically creating Dropdown Panel in JS

          It seems that modifying the Dropdown list of Labels in JS is not supported right now: Using Panorama Debugger, only the first Label will be shown, but the UI has all the labels as in the XML files, therefore FindChild for Id's other than the first Label will return null.

          Aside that, in JS, CreatePanel("Label", ...) for a Dropdown would create the proper Childs as seen in the Panorama Debugger. But in the UI, no dropdown options could be seen (only the last CreatePanel-created Label could be seen as the default selected Label)

          Comment

          Working...
          X