Exemplo n.º 1
0
 protected override void OnFocus(FocusEvent e)
 {
     if (form != null)
     {
         GetContainingInputManager().ChangeFocus(form);
     }
     base.OnFocus(e);
 }
Exemplo n.º 2
0
        public void BeginInput()
        {
            InputStart = TextLines.Length;
            InputText  = "";

            TextReadOnly = false;

            FocusEvent?.Invoke();
        }
Exemplo n.º 3
0
 protected virtual void OnFocusChanged(FocusEvent focused, GLBaseControl ctrl)   // focused elements or parents up to GLForm gets this as well
 {
     this.focused = focused == FocusEvent.Focused;
     if (InvalidateOnFocusChange)
     {
         Invalidate();
     }
     FocusChanged?.Invoke(this, focused, ctrl);
 }
Exemplo n.º 4
0
 private void OnSearchTextFieldFocus(FocusEvent evt)
 {
     if (showingPlaceHolder)
     {
         SearchTextField.value = string.Empty;
         SearchTextField.RemoveFromClassList("placeholder");
         showingPlaceHolder = false;
     }
 }
Exemplo n.º 5
0
        protected internal override void ExecuteDefaultAction(EventBase evt)
        {
            base.ExecuteDefaultAction(evt);

            if (evt.GetEventTypeId() == FocusEvent.TypeId())
            {
                m_ObjectFieldDisplay.Focus();
            }
        }
        protected internal override void ExecuteDefaultAction(EventBase evt)
        {
            base.ExecuteDefaultAction(evt);

            // Focus first field if any
            if (evt.GetEventTypeId() == FocusEvent.TypeId())
            {
                m_PositionField.Focus();
            }
        }
Exemplo n.º 7
0
            protected override void OnFocus(FocusEvent e)
            {
                if (Current.Disabled)
                    return;

                OnFocused?.Invoke();
                base.OnFocus(e);

                GetContainingInputManager().TriggerFocusContention(this);
            }
Exemplo n.º 8
0
 /// <summary>
 /// 广播事件
 /// </summary>
 /// <param name="event">事件类型</param>
 /// <param name="context">发布广播的监听器</param>
 /// <param name="eventControl">触发事件的控件</param>
 public static void Broadcast(FocusEvent @event, FocusListener context, Control eventControl)
 {
     foreach (FocusListener listener in Instance.FocusListeners)
     {
         if (listener != null && listener != context)
         {
             listener.OnBroadcast(@event, context, eventControl);
         }
     }
 }
Exemplo n.º 9
0
        void OnFieldFocus(FocusEvent evt)
        {
            VseWindow window = ((VseGraphView)m_GraphView).window;

            if (window != null)
            {
                window.RefreshUIDisabled = true;
            }
            Undo.undoRedoPerformed += UndoRedoPerformed;
        }
        protected internal override void ExecuteDefaultAction(EventBase evt)
        {
            base.ExecuteDefaultAction(evt);

            // Delegate focus to the control
            if (evt.GetEventTypeId() == FocusEvent.TypeId())
            {
                m_Control.Focus();
            }
        }
Exemplo n.º 11
0
        protected internal override void ExecuteDefaultAction(EventBase evt)
        {
            base.ExecuteDefaultAction(evt);

            // Focus first field if any
            if (evt.GetEventTypeId() == FocusEvent.TypeId() && m_Fields.Count > 0)
            {
                m_Fields[0].Focus();
            }
        }
Exemplo n.º 12
0
        protected override void OnFocus(FocusEvent e)
        {
            AutoSizeDuration = 500;
            AutoSizeEasing   = Easing.OutQuint;

            pressAKey.FadeIn(300, Easing.OutQuint);
            pressAKey.BypassAutoSizeAxes &= ~Axes.Y;

            updateBindTarget();
            base.OnFocus(e);
        }
 /// <inheritdoc cref="GLOFC.GL4.Controls.GLBaseControl.OnFocusChanged(FocusEvent, GLBaseControl)"/>
 protected override void OnFocusChanged(FocusEvent evt, GLBaseControl fromto)
 {
     if (evt == FocusEvent.Deactive) // if lost focus
     {
         if (!IsValid)               // if text box is not valid, go back to the original colour with no change event
         {
             Value = number;
         }
     }
     base.OnFocusChanged(evt, fromto);
 }
Exemplo n.º 14
0
            protected override void OnFocus(FocusEvent e)
            {
                // do not trigger origin focus event if this drawable has been removed.
                // usually cause by user clicking the delete button.
                if (Parent == null)
                {
                    return;
                }

                base.OnFocus(e);
            }
Exemplo n.º 15
0
        void OnFocus(FocusEvent evt)
        {
            if (!m_IsFocused)
            {
                m_FilteredChoices      = m_Choices.ToList();
                m_ListView.itemsSource = m_FilteredChoices;
                RefreshLayout();
                SetValueWithoutNotify("");
            }

            m_IsFocused = true;
        }
Exemplo n.º 16
0
 public virtual void ExecuteDefaultAction(EventBase evt)
 {
     if (evt.GetEventTypeId() == FocusEvent.TypeId())
     {
         editorEngine.OnFocus();
     }
     else if (evt.GetEventTypeId() == BlurEvent.TypeId())
     {
         editorEngine.OnLostFocus();
         editorEngine.SelectNone();
     }
 }
Exemplo n.º 17
0
 public void OnFocusChanged(FocusEvent newFocus)
 {
     IsFocused = newFocus == FocusEvent.FocusIn;
     if (IsFocused)
     {
         m_cursorBlink         = true;
         m_cursorBlinkLastTime = GameFacade.LastUpdateState.Time.TotalRealTime.Ticks;
     }
     else
     {
         m_cursorBlink = false;
     }
 }
        void OnFocusEvent(FocusEvent evt)
        {
            if (m_SelectedItem != null)
            {
                m_SelectedItem.content.RemoveFromClassList(k_ViewSelectedWithNoFocusVariantUssClassName);
                if (!EditorGUIUtility.isProSkin)
                {
                    m_SelectedItem.SwitchToDarkSkinIcon();
                }

                m_SelectedItem.content.AddToClassList(k_PlainViewSelectedVariantUssClassName);
            }
        }
Exemplo n.º 19
0
        protected internal override void ExecuteDefaultAction(EventBase evt)
        {
            base.ExecuteDefaultAction(evt);

            if (evt.GetEventTypeId() == FocusEvent.TypeId())
            {
                m_SetKbControl = true;
            }
            if (evt.GetEventTypeId() == BlurEvent.TypeId())
            {
                m_ResetKbControl = true;
            }
        }
Exemplo n.º 20
0
 public void OnFocusChanged(FocusEvent newFocus)
 {
     IsFocused = newFocus == FocusEvent.FocusIn;
     if (IsFocused)
     {
         m_cursorBlink         = true;
         m_cursorBlinkLastTime = GameFacade.LastUpdateState.Time.TotalGameTime.Ticks;
     }
     else
     {
         m_cursorBlink  = false;
         SelectionEnd   = -1;
         SelectionStart = -1;
         m_DrawDirty    = true;
     }
 }
Exemplo n.º 21
0
 public void OnFocusChanged(FocusEvent newFocus)
 {
     IsFocused = newFocus == FocusEvent.FocusIn;
     if (IsFocused)
     {
         m_cursorBlink         = true;
         m_cursorBlinkLastTime = GameFacade.LastUpdateState.Time.TotalGameTime.Ticks;
         if (FSOEnvironment.SoftwareKeyboard)
         {
         }
     }
     else
     {
         m_cursorBlink = false;
     }
 }
        private void OnScopeTextFieldFocus(FocusEvent e)
        {
            var textField = e.target as TextField;

            if (textField != null)
            {
                var previousIndex = draft.selectedScopeIndex;
                var scopeIndex    = textField.parent.IndexOf(textField);
                if (previousIndex == scopeIndex)
                {
                    return;
                }
                draft.selectedScopeIndex = scopeIndex;
                RefreshScopeSelection();
            }
        }
Exemplo n.º 23
0
        public virtual void ExecuteDefaultAction(EventBase evt)
        {
            if (evt.eventTypeId == FocusEvent.TypeId())
            {
                editorEngine.OnFocus();

                // Make sure to select all text, OnFocus() does not call SelectAll for multiline text field.
                // However, in IMGUI it will be call later by the OnMouseUp event.
                editorEngine.SelectAll();
            }
            else if (evt.eventTypeId == BlurEvent.TypeId())
            {
                editorEngine.OnLostFocus();
                editorEngine.SelectNone();
            }
        }
Exemplo n.º 24
0
        protected internal override void ExecuteDefaultAction(EventBase evt)
        {
            base.ExecuteDefaultAction(evt);

            if (evt.GetEventTypeId() == FocusEvent.TypeId())
            {
                m_SetKbControl = true;
                // Make sure the inner IMGUIContainer is receiving the focus
                m_ColorField.Focus();
            }

            if (evt.GetEventTypeId() == BlurEvent.TypeId())
            {
                m_ResetKbControl = true;
            }
        }
Exemplo n.º 25
0
        public virtual void ExecuteDefaultAction(EventBase evt)
        {
            if (evt.eventTypeId == FocusEvent.TypeId())
            {
                editorEngine.OnFocus();

                // Make sure to select all text, OnFocus() does not call SelectAll for multiline text field.
                // If focused from the mouse, it will be called later by the OnMouseUp event.
                // This is needed when focus is obtained through a keyboard event (i.e. Tab).
                editorEngine.SelectAll();
            }
            else if (evt.eventTypeId == BlurEvent.TypeId())
            {
                editorEngine.OnLostFocus();
                editorEngine.SelectNone();
            }
        }
Exemplo n.º 26
0
        static void OnFocus(this IRenamable renamable, FocusEvent evt)
        {
            var textField = renamable.TitleEditor as TextField;

            textField?.SelectAll();

            VseWindow window = renamable.TitleElement.GetFirstAncestorOfType <VseGraphView>()?.window;

            // OnBlur is not called after a function is created in a new window and the window is closed, e.g. in tests
            ((VisualElement)renamable).RegisterCallback <DetachFromPanelEvent>(Callback);
            if (window != null)
            {
                window.RefreshUIDisabled = true;
            }

            renamable.TitleEditor.UnregisterCallback <FocusEvent>(renamable.OnFocus);

            Undo.undoRedoPerformed += renamable.UndoRedoPerformed;
        }
Exemplo n.º 27
0
 /// <inheritdoc cref="GLOFC.GL4.Controls.GLBaseControl.OnFocusChanged(FocusEvent, GLBaseControl)"/>
 protected override void OnFocusChanged(FocusEvent evt, GLBaseControl fromto) // called if we get focus (focused=true) or if child gets focused (focused=false)
 {
     if (evt == FocusEvent.ChildFocused)                                      // need to take a note
     {
         if (ControlsZ.Contains(fromto))
         {
             //System.Diagnostics.Debug.WriteLine("Form saw child focused {0} '{1}'", evt, fromto?.Name);
             lastchildfocus = fromto;
         }
     }
     else if (evt == FocusEvent.Focused)     // we got focus, hand off to child
     {
         if (lastchildfocus != null)
         {
             lastchildfocus.SetFocus();
             //System.Diagnostics.Debug.WriteLine("Form focus, focus on child");
         }
     }
 }
        private async Task AddFocusEventAsync(UIElement uiElement)
        {
            if (uiElement != null)
            {
                await DebugConsoleViewModel.Instance.VisualTreeView.SelectItem(
                    uiElement,
                    refreshOnFail : true // need to refresh because otherwise if the tree is not up to date - selection won't change for elements in the tree already loaded
                    );

                var fe = new FocusEvent(DebugConsoleViewModel.Instance.VisualTreeView.SelectedItem);
                this.FocusEvents.Add(fe);
                this.SelectedEvent = fe;
            }
            else
            {
                var fe = new FocusEvent(null);
                this.FocusEvents.Add(fe);
                this.SelectedEvent = fe;
            }
        }
Exemplo n.º 29
0
        public void OnBroadcast(FocusEvent @event, FocusListener context, Control eventControl)
        {
            // 判断是不是其他监听器的消息(广播转发的时候其实已经过滤了,这句判断可以不加)
            if (context != this)
            {
                switch (@event)
                {
                case FocusEvent.Got:
                    // 如果是其他监听器下的控件获得了焦点,且焦点最后的状态记录为true,则主动执行失去焦点的事件函数
                    if (isOnFocus && !ChildControls.Contains(eventControl))
                    {
                        ChildControl_LostFocus(lastOnFocusControl, new EventArgs());
                    }
                    break;

                case FocusEvent.Lost:

                    break;
                }
            }
        }
Exemplo n.º 30
0
        internal void Initialize(Field field, FocusEvent focusList, EventHandler textChanged)
        {
            this.focusListener = focusList;
            this.textChanged   = textChanged;
            this.field         = field;

            this.Enter       += new EventHandler(SecureTextBox_Enter);
            this.Leave       += new EventHandler(SecureTextBox_Leave);
            this.TextChanged += new EventHandler(SecureTextBox_TextChanged);

            MenuItem mnuItemNew = new MenuItem();

            mnuItemNew.Text = "&Clear";

            //THIS textbox HAS a context menu ALREADY BUT here we assign a new context menu to
            //our text box to replace the old one which had cut, paste etc. that we don't want
            //the agent using...
            this.ContextMenu = new ContextMenu();
            this.ContextMenu.MenuItems.Add(mnuItemNew);

            mnuItemNew.Click += new EventHandler(clear_Click);

            SwitchModes();
        }
Exemplo n.º 31
0
 public void OnFocusChanged(FocusEvent newFocus)
 {
     IsFocused = newFocus == FocusEvent.FocusIn;
     if (IsFocused)
     {
         m_cursorBlink = true;
         m_cursorBlinkLastTime = GameFacade.LastUpdateState.Time.TotalGameTime.Ticks;
     }
     else
     {
         m_cursorBlink = false;
     }
 }
Exemplo n.º 32
0
 public void OnFocusChanged(FocusEvent newFocus)
 {
     IsFocused = newFocus == FocusEvent.FocusIn;
     if (IsFocused)
     {
         m_cursorBlink = true;
         m_cursorBlinkLastTime = GameFacade.LastUpdateState.Time.TotalRealTime.Ticks;
     }
     else
     {
         m_cursorBlink = false;
         SelectionEnd = -1;
         SelectionStart = -1;
         m_DrawDirty = true;
     }
 }
 private async Task AddFocusEventAsync(UIElement uiElement)
 {
     if (uiElement != null)
     {
         await DebugConsoleViewModel.Instance.VisualTreeView.SelectItemAsync(
             uiElement,
             refreshOnFail: true // need to refresh because otherwise if the tree is not up to date - selection won't change for elements in the tree already loaded
             );
         var fe = new FocusEvent(DebugConsoleViewModel.Instance.VisualTreeView.SelectedItem);
         this.FocusEvents.Add(fe);
         this.SelectedEvent = fe;
     }
     else
     {
         var fe = new FocusEvent(null);
         this.FocusEvents.Add(fe);
         this.SelectedEvent = fe;
     }
 }
 private async Task AddFocusEventAsync(UIElement uiElement)
 {
     await DebugConsoleViewModel.Instance.VisualTreeView.SelectItem(uiElement);
     var fe = new FocusEvent(DebugConsoleViewModel.Instance.VisualTreeView.SelectedItem);
     this.FocusEvents.Add(fe);
     this.SelectedEvent = fe;
 } 
Exemplo n.º 35
0
 public void OnFocusChanged(FocusEvent newFocus)
 {
     IsFocused = newFocus == FocusEvent.FocusIn;
     if (IsFocused)
     {
         m_cursorBlink = true;
         m_cursorBlinkLastTime = GameFacade.LastUpdateState.Time.TotalGameTime.Ticks;
         if (FSOEnvironment.SoftwareKeyboard)
         {
             try
             {
                 Guide.BeginShowKeyboardInput(PlayerIndex.One, "", "", CurrentText, (ar) =>
                 {
                     var str = Guide.EndShowKeyboardInput(ar);
                     lock (this)
                     {
                         QueuedChange = str;
                     }
                 }, null);
             }
             catch (Exception e) { }
         }
     }
     else
     {
         m_cursorBlink = false;
     }
 }
 /// <summary>
 /// is invoked when a window gains the keyboard focus.
 /// </summary>
 /// <param name="focusEvent">The focus event.</param>
 public void focusGained(FocusEvent focusEvent)
 {
 }
        //The window which has the keyboard focus is the window which gets the keyboard events.

        /// <summary>
        /// is invoked when a window loses the keyboard focus. 
        /// </summary>
        /// <param name="_focusEvent">The _focus event.</param>
        public void focusLost(FocusEvent _focusEvent)
        {
            short nFocusFlags = _focusEvent.FocusFlags;
            int nFocusChangeReason = nFocusFlags & FocusChangeReason.TAB;
            if (nFocusChangeReason == FocusChangeReason.TAB)
            {
                // get the window of the Window that has gained the Focus...
                // Note that the xWindow is just a representation of the controlwindow
                // but not of the control itself
                XWindow xWindow = (XWindow)_focusEvent.NextFocus;
            }
        }