Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

New UI Widgets

Discussion in 'Assets and Asset Store' started by ilih, Feb 11, 2015.

  1. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    701
    Done.
    Please add this code to ObservableList.cs
    Code (CSharp):
    1.         /// <summary>
    2.         /// Initializes a new instance of the <see cref="ObservableList{T}"/> class.
    3.         /// </summary>
    4.         /// <param name="capacity">List capacity.</param>
    5.         public ObservableList(int capacity)
    6.             : this(true, capacity)
    7.         {
    8.         }
     
    jGate99 likes this.
  2. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
    @ilih,

    I noticed that IsVisible(index) does some crazy calculations, which is great for precise and perfect visibility checks.

    So for lightweight checks can you please add another function where you already know how many component items are drawn/set (even partially hidden) and can check if given index falls under them
     
  3. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    701
    You can use
    IsItemVisible(index)
    in this case.
     
    jGate99 likes this.
  4. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
    Exactly, thank you very much
     
  5. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
    Hi @ilih
    Is it me or range control having two different implementation for int and float seems overkill. It limits us from using 1 range control for both cases. Usually this control has a "whole number" like check box which turns it into float or int based.
    So having 1 control'd be really great.
    Thanks
     
  6. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    701
    There are a few reasons why it's two versions:
    • int
      and
      float
      gives different result with same operation, for example
      (5 / 2) == 2
      (5 / 2.0f) == 2.5
      So better to have the option to work with the required type and not bothering with type conversion. It could be done with two fields like ValueFloat and ValueInt, but I think this is more confusing.
    • float
      version has "Whole Number of Steps" option, so you can use it instead of the
      int
      version if step, min value, max value are the whole numbers
     
    jGate99 likes this.
  7. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
    @ilih
    Multiselect dropdown items are not variable height, so that dropdown goes beyond the scrollview area horizontally if item has long text, how can i make it variable height? thanks
     
  8. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    701
    You need to change Combobox.ListView.ListType to "List View with Variable Size" and layout group to DefaultItem so it should change size with text.
    Or if you using simple string Combobox then replace Combobox.ListView with ListViewHeight created from a context menu.
     
    jGate99 likes this.
  9. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
    @ilih,
    ComboBox shows selected items in EasyLayout, and it layouts items in flow layout way which is fine. However when i encounter a selected item which has bigger width than easy layout itself then even it pushes item to new row; item still takes more width and increases EasyLayout width.
    So it'd be really great if there is a max item width option along with prefered item width, so if prefered item takes more width than max width, dont let it have max width and item this way become multiline.
    Thanks
     
  10. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    701
    Please try update to v1.10.4b3.
    I added LayoutElementMax component to control the maximum of the preferred sizes Layout Group.

    Probably you need also to change Container EasyLayout.ChilderHeight to "Set Preferred"
     
    jGate99 likes this.
  11. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
    @ilih,
    ComboBox has OnSelect event but not OnDeselect?
     
  12. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
    Thanks for this feature.
     
  13. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    701
    You need to use OnSelect and OnDeselect with Combobox.ListView, not Combobox itself.
     
    jGate99 likes this.
  14. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
    please also move IsItemVisible to ListViewBase so we can access it from Owner.
    Thanks
     
  15. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    701
    OK, I also check what other functions can be defined in the base class.
     
    jGate99 likes this.
  16. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
    Thanks
     
  17. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
  18. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    701
    I'll try to make an example.
    This should be simple: by default list with null values and another DefaultItem with gray blocks instead of the content and after loading, replace DefaultItem and list with actual data.
    Only needed the shader to make the color change.
     
    jGate99 likes this.
  19. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
    thanks, really appreciate that :)
    please also expose shader color so we can change it from black to light white on dark uis
     
  20. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    701
    Please check Examples/ListView/ListViewLoading scene and script in v1.10.4b6
    Shader located in Shaders/UIFlare with FlareColor, FlareSize, and FlareSpeed properties.
     
    jGate99 likes this.
  21. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
    Awesome :D
     
  22. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
    @ilih
    I have a case for List View, where i want to show next and previous item buttons for users who dont want to scroll items but rather scrollTo items one by one.
    So we already have ListView.ScrollTo(index).
    So can you please make
    DisplayedIndicesFirst and Last public. so we can
    Show Previous ListView.ScrollTo(DisplayedIndicesFirst-1);
     
  23. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    701
    Please check ListViewPaginator, probably this what you needed.
     
    jGate99 likes this.
  24. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
    I'm actually using vertical listview with dynamic height as this is used to show articles. Now what i prefer is a method that ScrollToIndex (with/without animation) and position the requested index to listview's top edge, so when user look at list view that requested index's item is visible on top instead of in middle or bottom
     
  25. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    701
    OK, I'll change DisplayedIndicesFirst and DisplayedIndicesLast to the public in the next update.
     
    jGate99 likes this.
  26. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
    Also please provide a method that ScrollTo and Show that Item at top edge?
     
  27. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    701
    This can be done with
    ListView.ScrollToPosition(ListView.GetItemPosition(index))
    or
    ListView.ScrollToPositionAnimated(ListView.GetItemPosition(index))
    .
     
    jGate99 likes this.
  28. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
    Working beautifully with DisplayedIndicesFirst + 1
    Thanks
     
  29. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
    Hi ilih
    I tested it in detail today and it looks great
    However setting a new default item destroy old cached items.
    So it'd be great if you can add a proper support for such items, this way whenever we request new data for example show leaderboard by friend or country then it wont have to destroy old pooled components.
     
  30. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    701
    I'll try to add support for it.
     
    jGate99 likes this.
  31. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866

    Thanks for adding this feature on my earlier request.
    Now it doesnt close the item so user can select all the other options.


    But there is still an issue and that require improvment which is while popup is open and user is selecting items,
    OnSelect events gets triggered every time. So ideally it should only trigger when user close the popup this way we avoid unnecessary event handling.

    Thanks
     
  32. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    701
    I'll add the events on open and on close popup ListView to Combobox, and script which uses both events and invokes another event with indices of the selected and deselected items on close.
     
    jGate99 likes this.
  33. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    701
    Please check v1.10.5b1
    Added new option DestroyDefaultItemsCache, you need to disabled it.

    Added OnShowListView and OnHideListView events to Combobox.
    Check Examples/Combobox/ComboboxChanges scene and script.
     
    jGate99 likes this.
  34. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
    DestroyDefaultItemsCache is going to be huge help, thanks for making UI Widgets more amazing :)
     
  35. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    701
    v1.10.4 released

    Changelog:
    • added DateScroller, DateTimeScroller, DateTimeScrollerSeparate, TimeScroller widgets
    • added EditorCondition attributes to use with MonoBehaviourConditional and UIBehaviourConditional
    • added LayoutElementMax: allow to control the maximum preferred sizes of the LayoutGroup
    • added UIFlare shader
    • Combobox: added HideAfterItemToggle option
    • DateTime: fixed init and time errors
    • DatePicker: added DateChangeOnly option to allow to select date on change or on click
    • EasyLayout: fixed FitContainer
    • ListView: added null value support for the GraphicsForeground and GraphicsBackground properties
    • ListView: added AllowColoring option
    • ListView: added StateDefault(), StateSelected() and StateHighlighted() functions to the base default item class as addition to coloring functions
    • ListView: added loading example with UIFlare shader use
     
    hopeful and jGate99 like this.
  36. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
    @ilih
    Single click/tap on list item selects or deselcts which works fine.
    However i want to handle double tap differently, how can i achieve that?

    Thanks
     
  37. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    701
    Create a function in the DefaultItem component class to process the double click and attach to DefaultItem.OnDoubleClick.
     
    jGate99 likes this.
  38. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866

    Sorry for causing the confusion, im actually refering to simple list/tile view.
    Thanks
     
  39. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    701
    I am sorry, I should mention it first: screenshot made for TreeView, but it works the same for the ListView and TileView.
     
    helloworldgames and jGate99 like this.
  40. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
    OOps, i see it now :D
    Thanks
     
  41. Mario020

    Mario020

    Joined:
    Jun 20, 2017
    Posts:
    24
    I imported the new version (didn't get an update button in unity asset store so I don't know if there is a difference) I am experiencing compile errors with this last release. I get the error 'a type has the same name as the workspace' ( EasyLayout namespace was before EasyLayoutNS) and ListviewiItemEventdata is used but empty but with 'should be deleted'.
     
  42. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
    Simply delete ui widgets folder, and then import the latest version.
     
    Mario020 and ilih like this.
  43. Mario020

    Mario020

    Joined:
    Jun 20, 2017
    Posts:
    24
    jGate99 likes this.
  44. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
    @ilih, can we now use same list view on runtime for both verticall (1 item) and tile (vertical) on runtime? because now default items will be cached for different types and all i have to do is assign releated default item and change list view type on runtime?
     
  45. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    701
    Yes.
     
    jGate99 likes this.
  46. sanjaysungh

    sanjaysungh

    Joined:
    Sep 1, 2019
    Posts:
    1
    Is it possible to create tooltip like this in unity
     
    jGate99 likes this.
  47. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
    Yes, Ui Widgets has tooltips which can be made like your link
     
  48. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    701
    Yes, add tooltip component to gameobject and then change tooltip content and size to what you need.
     
  49. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    866
  50. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    701
    Added ScrollRectHeader in v1.10.5b2.
    Please Examples/ListView/ListViewHeader scene.

    Gameobjects settings:
    • Add Header gameobject after ListView.Container in hierarchy
    • disable EasyLayout.Symmetric at ListView.Container and EasyLayout.MarginTop to Header height + some margin
     
    jGate99 likes this.