Exemplo n.º 1
0
        void CreateSearchField(string ussClass)
        {
            m_SearchField = new ToolbarSearchField
            {
                value = string.IsNullOrEmpty(BaseState.SearchFilter) ? string.Empty : BaseState.SearchFilter
            };
            m_SearchField.AddToClassList(ussClass);
            m_SearchField.Q("unity-cancel").AddToClassList(UssClasses.DotsEditorCommon.SearchFieldCancelButton);
            m_SearchField.RegisterValueChangedCallback(OnFilterChanged);

            UIElementHelper.ToggleVisibility(m_SearchField, BaseState.IsSearchFieldVisible);
        }
Exemplo n.º 2
0
        protected void SetSearchFieldVisibility(bool visible)
        {
            BaseState.IsSearchFieldVisible = visible;
            if (m_SearchField == null)
            {
                return;
            }

            if (visible)
            {
                UIElementHelper.Show(m_SearchField);
                m_SearchField.Q("unity-text-input").Focus();
            }
            else
            {
                UIElementHelper.Hide(m_SearchField);
            }

            OnFilterChanged(SearchFilter);
        }