private void OnEnterPanel(AttachToPanelEvent evt) { AddFromUrlFieldContainer.RegisterCallback <FocusEvent>(OnContainerFocus); AddFromUrlFieldContainer.RegisterCallback <FocusOutEvent>(OnContainerFocusOut); UrlTextField.RegisterCallback <FocusEvent>(OnUrlTextFieldFocus); UrlTextField.RegisterCallback <FocusOutEvent>(OnUrlTextFieldFocusOut); UrlTextField.RegisterCallback <ChangeEvent <string> >(OnUrlTextFieldChange); UrlTextField.RegisterCallback <KeyDownEvent>(OnKeyDownShortcut); Hide(); }
public PackageAddFromUrlField() { var root = Resources.GetTemplate("PackageAddFromUrlField.uxml"); Add(root); Cache = new VisualElementCache(root); AddButton.clickable.clicked += OnAddButtonClick; RegisterCallback <MouseDownEvent>(evt => Hide()); AddFromUrlFieldContainer.RegisterCallback <MouseDownEvent>(evt => { EditorApplication.delayCall += () => { UrlTextField.visualInput.Focus(); }; evt.StopPropagation(); }); UrlTextField.RegisterCallback <ChangeEvent <string> >(OnUrlTextFieldChange); }