public void ReplaceAll(Regex find, string replace) { Execute(() => { try { var offset = 0; EditBox.BeginChange(); foreach (Match match in find.Matches(EditBox.Text)) { var replaceWith = match.Result(replace); EditBox.Document.Replace(offset + match.Index, match.Length, replaceWith); offset += replaceWith.Length - match.Length; } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } finally { EditBox.EndChange(); } }); }
protected FilePropertyEditor(IPropertyEditorParams editorParams, string[] allowedFileTypes) : base(editorParams) { ContainerWidget.AddNode(new Widget { Layout = new HBoxLayout(), Nodes = { (editor = editorParams.EditBoxFactory()), new HSpacer(4), (button = new ThemedButton { Text = "...", MinMaxWidth = 20, LayoutCell = new LayoutCell(Alignment.Center) }) } }); editor.LayoutCell = new LayoutCell(Alignment.Center); editor.Submitted += text => AssignAsset(AssetPath.CorrectSlashes(text)); button.Clicked += () => { var dlg = new FileDialog { AllowedFileTypes = allowedFileTypes, Mode = FileDialogMode.Open, InitialDirectory = Directory.Exists(LastOpenedDirectory) ? LastOpenedDirectory : Project.Current.GetSystemDirectory(Document.Current.Path), }; if (dlg.RunModal()) { SetFilePath(dlg.FileName); LastOpenedDirectory = Project.Current.GetSystemDirectory(dlg.FileName); } }; }
private void InitializeComponent() { this.ReferenceTextBox = new EditBox(); this.focusLabel7 = new FocusLabel(); this.WidthTextBox = new EditBox(); this.focusLabel6 = new FocusLabel(); this.label4 = new FocusLabel(); this.WidthStyleComboBox = new ComboBox(); base.SuspendLayout(); this.ReferenceTextBox.LoadingBegin(); this.ReferenceTextBox.Location = new Point(96, 32); this.ReferenceTextBox.Name = "ReferenceTextBox"; this.ReferenceTextBox.PropertyName = "Reference"; this.ReferenceTextBox.Size = new Size(56, 20); this.ReferenceTextBox.TabIndex = 0; this.ReferenceTextBox.LoadingEnd(); this.focusLabel7.LoadingBegin(); this.focusLabel7.FocusControl = this.ReferenceTextBox; this.focusLabel7.Location = new Point(38, 34); this.focusLabel7.Name = "focusLabel7"; this.focusLabel7.Size = new Size(58, 15); this.focusLabel7.Text = "Reference"; this.focusLabel7.LoadingEnd(); this.WidthTextBox.LoadingBegin(); this.WidthTextBox.Location = new Point(96, 56); this.WidthTextBox.Name = "WidthTextBox"; this.WidthTextBox.PropertyName = "Width"; this.WidthTextBox.Size = new Size(56, 20); this.WidthTextBox.TabIndex = 1; this.WidthTextBox.LoadingEnd(); this.focusLabel6.LoadingBegin(); this.focusLabel6.FocusControl = this.WidthTextBox; this.focusLabel6.Location = new Point(60, 58); this.focusLabel6.Name = "focusLabel6"; this.focusLabel6.Size = new Size(36, 15); this.focusLabel6.Text = "Width"; this.focusLabel6.LoadingEnd(); this.label4.LoadingBegin(); this.label4.FocusControl = this.WidthStyleComboBox; this.label4.Location = new Point(169, 58); this.label4.Name = "label4"; this.label4.Size = new Size(63, 15); this.label4.Text = "Width Style"; this.label4.LoadingEnd(); this.WidthStyleComboBox.Location = new Point(232, 56); this.WidthStyleComboBox.Name = "WidthStyleComboBox"; this.WidthStyleComboBox.PropertyName = "WidthStyle"; this.WidthStyleComboBox.Size = new Size(121, 21); this.WidthStyleComboBox.TabIndex = 2; base.Controls.Add(this.label4); base.Controls.Add(this.WidthStyleComboBox); base.Controls.Add(this.ReferenceTextBox); base.Controls.Add(this.focusLabel7); base.Controls.Add(this.WidthTextBox); base.Controls.Add(this.focusLabel6); base.Location = new Point(10, 20); base.Name = "PlotChannelBarSpecificEditorPlugIn"; base.Size = new Size(728, 328); base.ResumeLayout(false); }
public bool Find(Regex find) { return(Execute(() => { try { var previous = find.Options.HasFlag(RegexOptions.RightToLeft); var start = previous ? EditBox.SelectionStart : EditBox.SelectionStart + EditBox.SelectionLength; var match = find.Match(EditBox.Text, start); if (!match.Success) // start again from beginning or end { match = find.Match(EditBox.Text, previous ? EditBox.Text.Length : 0); } if (match.Success) { EditBox.Select(match.Index, match.Length); var loc = EditBox.Document.GetLocation(match.Index); EditBox.ScrollTo(loc.Line, loc.Column); } return match.Success; } catch (Exception e) { Trace.WriteLine(e.ToString()); return false; } })); }
public TextPropertyEditor(IPropertyEditorParams editorParams) : base(editorParams) { ThemedButton button; EditorContainer.AddNode(new Widget { Layout = new HBoxLayout(), Nodes = { (editor = editorParams.EditBoxFactory()), Spacer.HSpacer(4), (button = new ThemedButton { Text = "...", MinMaxWidth = 20, LayoutCell = new LayoutCell(Alignment.Center) }) } }); editor.LayoutCell = new LayoutCell(Alignment.Center); editor.Editor.EditorParams.MaxLines = maxLines; editor.MinHeight += editor.TextWidget.FontHeight * (maxLines - 1); var first = true; var submitted = false; var current = CoalescedPropertyValue(); editor.AddChangeLateWatcher(current, v => editor.Text = v.IsDefined ? v.Value : ManyValuesText); button.Clicked += () => { var window = new TextEditorDialog(editorParams.DisplayName ?? editorParams.PropertyName, editor.Text, (s) => { SetProperty(s); }); }; editor.Submitted += text => Submit(); editor.AddChangeLateWatcher(() => editor.Text, text => { if (first) { first = false; return; } if (!editor.IsFocused()) { return; } if (submitted) { Document.Current.History.Undo(); } submitted = true; Submit(); }); editor.AddChangeLateWatcher(() => editor.IsFocused(), focused => { if (submitted) { Document.Current.History.Undo(); } if (!focused) { submitted = false; } }); ManageManyValuesOnFocusChange(editor, current); }
private void NumericUpDownPalette_ValueChanged(object sender, EventArgs e) { if (!Navigating) { int INDEX = int.Parse(IndexText.Text); byte P_INDEX = (byte)NumericUpDownPalette.Value; Write.WriteByte(P_INDEX, MiniPaletteIndex + INDEX); // Read palette pointer int paletteOffset = Read.ReadPointer(MiniPalettes + 8 * P_INDEX); // Fix both MINI frames EditBox.Sprites[4].Palette = new SpritePalette(SpritePalette.PaletteType.Color16, Read.ReadBytes(paletteOffset, 32)); EditBox.Sprites[5].Palette = EditBox.Sprites[4].Palette; NSE_Framework.Draw.uDrawSprite(ref bM1, EditBox.Sprites[4]); NSE_Framework.Draw.uDrawSprite(ref bM2, EditBox.Sprites[5]); PictureboxA1.Image = bM1; PictureboxA2.Image = bM2; if (EditBox.CurrentIndex == 4 || EditBox.CurrentIndex == 5) { EditBox.Redraw(); } } }
/// <summary> /// Starts edit mode on the callout graphic by installing a <see cref="EditBox"/> on the /// <see cref="Tile"/> of the <see cref="Graphic.ParentPresentationImage">parent PresentationImage</see>. /// </summary> /// <returns>True if edit mode was successfully started; False otherwise.</returns> public bool StartEdit() { // remove any pre-existing edit boxes EndEdit(); bool result = false; this.CoordinateSystem = CoordinateSystem.Destination; try { EditBox editBox = new EditBox(this.Text ?? string.Empty); editBox.Location = Point.Round(this.Location); editBox.Size = Rectangle.Round(this.BoundingBox).Size; editBox.Multiline = this.Multiline; editBox.FontName = this.FontName; editBox.FontSize = this.FontSize; editBox.ValueAccepted += OnEditBoxComplete; editBox.ValueCancelled += OnEditBoxComplete; InstallEditBox(_currentCalloutEditBox = editBox); result = true; } finally { this.ResetCoordinateSystem(); } return(result); }
static int set_onTextChange(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); EditBox obj = (EditBox)o; UnityEngine.Events.UnityAction <string, int> arg0 = null; LuaTypes funcType2 = LuaDLL.lua_type(L, 2); if (funcType2 != LuaTypes.LUA_TFUNCTION) { arg0 = (UnityEngine.Events.UnityAction <string, int>)ToLua.CheckObject(L, 2, typeof(UnityEngine.Events.UnityAction <string, int>)); } else { LuaFunction func = ToLua.ToLuaFunction(L, 2); arg0 = DelegateFactory.CreateDelegate(typeof(UnityEngine.Events.UnityAction <string, int>), func) as UnityEngine.Events.UnityAction <string, int>; } obj.onTextChange = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index onTextChange on a nil value" : e.Message)); } }
static int set_onEditResult(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); EditBox obj = (EditBox)o; System.Action <string> arg0 = null; LuaTypes funcType2 = LuaDLL.lua_type(L, 2); if (funcType2 != LuaTypes.LUA_TFUNCTION) { arg0 = (System.Action <string>)ToLua.CheckObject(L, 2, typeof(System.Action <string>)); } else { LuaFunction func = ToLua.ToLuaFunction(L, 2); arg0 = DelegateFactory.CreateDelegate(typeof(System.Action <string>), func) as System.Action <string>; } obj.onEditResult = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index onEditResult on a nil value" : e.Message)); } }
private static Rectangle ComputeEditBoxControlBounds(Control control, EditBox editBox) { Size sz = control.GetPreferredSize(Size.Empty); sz = new Size(Math.Max(Math.Max(sz.Width, editBox.Size.Width), 50), Math.Max(Math.Max(sz.Height, editBox.Size.Height), 21)); return(RectangleUtilities.ConvertToRectangle(editBox.Location, sz)); }
private void OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs) { IsVisibleChanged -= OnIsVisibleChanged; EditBox.Options.IndentationSize = 2; EditBox.Options.EnableHyperlinks = false; EditBox.Options.ConvertTabsToSpaces = true; EditBox.Options.AllowScrollBelowDocument = true; EditBox.Options.EnableHyperlinks = false; EditBox.Options.EnableEmailHyperlinks = false; EditBox.TextChanged += EditBoxOnTextChanged; Dispatcher.InvokeAsync(() => { var executeAutoSave = Utility.Debounce <string>(s => Dispatcher?.Invoke(ExecuteAutoSave), 4000); EditBox.TextChanged += (s, e) => executeAutoSave(null); EditBox.PreviewKeyDown += (s, e) => EditorSpellCheck.AppsKeyDown = e.Key == Key.Apps && e.IsDown; EditBox.Document.PropertyChanged += OnEditBoxPropertyChanged; DataObject.AddPastingHandler(EditBox, OnPaste); RestyleScrollBar(); EditorUtilities.AllowImagePaste(this); RemoveIndentationCommandBinding(); SetupTabSnippetHandler(); ThemeChangedCallback(this, new DependencyPropertyChangedEventArgs()); EditBox.Focus(); // fixes context menu not showing on first click ContextMenu = new ContextMenu(); ContextMenu.Items.Add(new MenuItem()); }); }
private void InitializeComponent() { this.StringTextBox = new EditBox(); this.label1 = new FocusLabel(); this.EventsEnabledCheckBox = new CheckBox(); base.SuspendLayout(); this.StringTextBox.LoadingBegin(); this.StringTextBox.Location = new Point(56, 32); this.StringTextBox.Name = "StringTextBox"; this.StringTextBox.PropertyName = "AsString"; this.StringTextBox.Size = new Size(320, 20); this.StringTextBox.TabIndex = 0; this.StringTextBox.LoadingEnd(); this.label1.LoadingBegin(); this.label1.FocusControl = this.StringTextBox; this.label1.Location = new Point(20, 34); this.label1.Name = "label1"; this.label1.Size = new Size(36, 15); this.label1.Text = "Value"; this.label1.LoadingEnd(); this.EventsEnabledCheckBox.Location = new Point(56, 64); this.EventsEnabledCheckBox.Name = "EventsEnabledCheckBox"; this.EventsEnabledCheckBox.PropertyName = "EventsEnabled"; this.EventsEnabledCheckBox.Size = new Size(120, 24); this.EventsEnabledCheckBox.TabIndex = 1; this.EventsEnabledCheckBox.Text = "Events Enabled"; base.Controls.Add(this.EventsEnabledCheckBox); base.Controls.Add(this.StringTextBox); base.Controls.Add(this.label1); base.Name = "ValueStringEditorPlugIn"; base.Size = new Size(408, 112); base.Title = "Value String Editor"; base.ResumeLayout(false); }
/// <summary> /// Starts edit mode on the callout graphic by installing a <see cref="EditBox"/> on the /// <see cref="Tile"/> of the <see cref="Graphic.ParentPresentationImage">parent PresentationImage</see>. /// </summary> /// <returns>True if edit mode was successfully started; False otherwise.</returns> public bool StartEdit() { // remove any pre-existing edit boxes EndEdit(); bool result = false; this.Graphic.CoordinateSystem = CoordinateSystem.Destination; try { EditBox editBox = new EditBox(_textGraphic.Text ?? string.Empty); if (string.IsNullOrEmpty(_textGraphic.Text)) { editBox.Value = SR.LabelEnterText; } editBox.Multiline = true; editBox.Location = Point.Round(_textGraphic.Location); editBox.Size = Rectangle.Round(_textGraphic.BoundingBox).Size; editBox.FontName = _textGraphic.Font; editBox.FontSize = _textGraphic.SizeInPoints; editBox.ValueAccepted += OnEditBoxComplete; editBox.ValueCancelled += OnEditBoxComplete; InstallEditBox(_currentCalloutEditBox = editBox); result = true; } finally { this.Graphic.ResetCoordinateSystem(); } return(result); }
private void OnPaste(object sender, DataObjectPastingEventArgs pasteEventArgs) { var text = (string)pasteEventArgs.SourceDataObject.GetData(DataFormats.UnicodeText, true); if (text == null) { return; } var modifiedText = _removeSpecialCharacters ? text.ReplaceSmartChars() : Uri.IsWellFormedUriString(text, UriKind.Absolute) ? Images.IsImageUrl(text) ? $"![]({text})\n" : $"<{text}>" : text; if (text == modifiedText) { return; } // AvalongEdit won't use new dataobject. Submitted bug 18 about this. pasteEventArgs.CancelCommand(); Clipboard.SetText(modifiedText); EditBox.Focus(); EditBox.Paste(); }
protected void OnLoadFile(string filename) { //base.OnLoadFile(filename); EditBox.Text = System.IO.File.ReadAllText(filename); EditBox.ClearUndo(); }
/// <summary> /// Invokes an interactive edit box on the name of the graphic, allowing the user to assign a name to the <see cref="IRoiGraphic"/>. /// </summary> public void Rename() { var parent = ParentGraphic; if (parent == null) { return; } this.CoordinateSystem = CoordinateSystem.Destination; try { EditBox editBox = new EditBox(parent.Name ?? string.Empty); editBox.Location = Point.Round(base.TextGraphic.Location); editBox.Size = Size.Round(base.TextGraphic.BoundingBox.Size); editBox.FontName = base.TextGraphic.Font; editBox.FontSize = base.TextGraphic.SizeInPoints; editBox.Multiline = false; editBox.ValueAccepted += OnEditBoxAccepted; editBox.ValueCancelled += OnEditBoxCancelled; base.ParentPresentationImage.Tile.EditBox = editBox; } finally { this.ResetCoordinateSystem(); } }
public TextPropertyEditor(IPropertyEditorParams editorParams) : base(editorParams) { EditorContainer.AddNode(new Widget { Layout = new HBoxLayout(), Nodes = { (editor = editorParams.EditBoxFactory()), Spacer.HSpacer(4), (button = new ThemedButton { Text = "...", MinMaxWidth = 20, LayoutCell = new LayoutCell(Alignment.Center) }) } }); editor.LayoutCell = new LayoutCell(Alignment.Center); editor.Editor.EditorParams.MaxLines = maxLines; editor.MinHeight += editor.TextWidget.FontHeight * (maxLines - 1); editor.Submitted += text => SetProperty(text); editor.AddChangeWatcher(CoalescedPropertyValue(), v => editor.Text = v); button.Clicked += () => { var window = new TextEditorDialog(editorParams.DisplayName ?? editorParams.PropertyName, editor.Text, (s) => { SetProperty(s); }); }; }
/// <summary> /// Starts edit mode on the callout graphic by installing a <see cref="EditBox"/> on the /// <see cref="Tile"/> of the <see cref="Graphic.ParentPresentationImage">parent PresentationImage</see>. /// </summary> /// <returns>True if edit mode was successfully started; False otherwise.</returns> public bool StartEdit() { // remove any pre-existing edit boxes EndEdit(); bool result = false; this.Graphic.CoordinateSystem = CoordinateSystem.Destination; try { EditBox editBox = new EditBox(_textGraphic.Text ?? string.Empty); if (string.IsNullOrEmpty(_textGraphic.Text)) editBox.Value = SR.LabelEnterText; editBox.Multiline = true; editBox.Location = Point.Round(_textGraphic.Location); editBox.Size = Rectangle.Round(_textGraphic.BoundingBox).Size; editBox.FontName = _textGraphic.Font; editBox.FontSize = _textGraphic.SizeInPoints; editBox.ValueAccepted += OnEditBoxComplete; editBox.ValueCancelled += OnEditBoxComplete; InstallEditBox(_currentCalloutEditBox = editBox); result = true; } finally { this.Graphic.ResetCoordinateSystem(); } return result; }
private void ResizeThumb_DragDelta(object sender, DragDeltaEventArgs e) { if (EditBox != null) { switch (VerticalAlignment) { case VerticalAlignment.Bottom: EditBox.ScaleAtBottom(e.VerticalChange); break; case VerticalAlignment.Top: EditBox.ScaleAtTop(e.VerticalChange); break; default: break; } switch (HorizontalAlignment) { case HorizontalAlignment.Left: EditBox.ScaleAtLeftPosition(); break; case HorizontalAlignment.Right: EditBox.ScaleAtRightPosition(); break; default: break; } } e.Handled = true; }
/// <summary> /// when any ky is pressed, the method will check and move the focused cell according to the arrow key direction /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SpreadsheetPanel_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Up) { ComputeArrowKeyMovement(0, -1); } else if (e.KeyCode == Keys.Down) { ComputeArrowKeyMovement(0, 1); } else if (e.KeyCode == Keys.Left) { ComputeArrowKeyMovement(-1, 0); } else if (e.KeyCode == Keys.Right) { ComputeArrowKeyMovement(1, 0); } else { EditBox.Focus(); } spreadsheetPanel.GetSelection(out int col, out int row); UpdateTextBoxInfo(col, row); }
private void InitializeComponent() { this.TerminatedCheckBox = new CheckBox(); this.ReferenceTextBox = new EditBox(); this.focusLabel6 = new FocusLabel(); base.SuspendLayout(); this.TerminatedCheckBox.Location = new Point(88, 16); this.TerminatedCheckBox.Name = "TerminatedCheckBox"; this.TerminatedCheckBox.PropertyName = "Terminated"; this.TerminatedCheckBox.Size = new Size(96, 24); this.TerminatedCheckBox.TabIndex = 0; this.TerminatedCheckBox.Text = "Terminated"; this.ReferenceTextBox.LoadingBegin(); this.ReferenceTextBox.Location = new Point(88, 48); this.ReferenceTextBox.Name = "ReferenceTextBox"; this.ReferenceTextBox.PropertyName = "Reference"; this.ReferenceTextBox.Size = new Size(56, 20); this.ReferenceTextBox.TabIndex = 1; this.ReferenceTextBox.LoadingEnd(); this.focusLabel6.LoadingBegin(); this.focusLabel6.FocusControl = this.ReferenceTextBox; this.focusLabel6.Location = new Point(30, 50); this.focusLabel6.Name = "focusLabel6"; this.focusLabel6.Size = new Size(58, 15); this.focusLabel6.Text = "Reference"; this.focusLabel6.LoadingEnd(); base.Controls.Add(this.TerminatedCheckBox); base.Controls.Add(this.ReferenceTextBox); base.Controls.Add(this.focusLabel6); base.Location = new Point(10, 20); base.Name = "PlotChannelDifferentialSpecificEditorPlugIn"; base.Size = new Size(512, 200); base.ResumeLayout(false); }
private void InitializeComponent() { this.EnabledCheckBox = new CheckBox(); this.MarginEditBox = new EditBox(); this.focusLabel4 = new FocusLabel(); base.SuspendLayout(); this.EnabledCheckBox.Location = new Point(96, 40); this.EnabledCheckBox.Name = "EnabledCheckBox"; this.EnabledCheckBox.PropertyName = "Enabled"; this.EnabledCheckBox.Size = new Size(72, 24); this.EnabledCheckBox.TabIndex = 0; this.EnabledCheckBox.Text = "Enabled"; this.MarginEditBox.LoadingBegin(); this.MarginEditBox.Location = new Point(96, 80); this.MarginEditBox.Name = "MarginEditBox"; this.MarginEditBox.PropertyName = "Margin"; this.MarginEditBox.Size = new Size(136, 20); this.MarginEditBox.TabIndex = 3; this.MarginEditBox.LoadingEnd(); this.focusLabel4.LoadingBegin(); this.focusLabel4.FocusControl = this.MarginEditBox; this.focusLabel4.Location = new Point(56, 82); this.focusLabel4.Name = "focusLabel4"; this.focusLabel4.Size = new Size(40, 15); this.focusLabel4.Text = "Margin"; this.focusLabel4.LoadingEnd(); base.Controls.Add(this.MarginEditBox); base.Controls.Add(this.focusLabel4); base.Controls.Add(this.EnabledCheckBox); base.Location = new Point(10, 20); base.Name = "PlotLegendWrappingEditorPlugIn"; base.Size = new Size(504, 336); base.ResumeLayout(false); }
static void Main(string[] args) { SFML.Portable.Activate(); var win = new RenderWindow(VideoMode.DesktopMode, "Test SFML"); win.Size = new Vector2u(600, 400); Gui gui = new Gui(win); EditBox editBoxUsername = new EditBox(); editBoxUsername.Position = new Vector2f(600 / 6, 400 / 6); editBoxUsername.Size = new Vector2f(600 * 2 / 3, 400 / 8); editBoxUsername.DefaultText = "Username"; gui.Add(editBoxUsername); while (win.IsOpen) { win.DispatchEvents(); win.Clear(Color.Blue); gui.Draw(); win.Display(); } win.Close(); win.Dispose(); Console.WriteLine("Hello World!"); }
public PropertiesFormTextBoxBrowser(EditableProperty property, Widget parent, EditUICallback uiCallback) : base(property, parent, "Anomalous.GuiFramework.Editor.GUI.PropertiesForm.PropertiesFormTextBoxBrowser.layout") { this.uiCallback = uiCallback; widget.ForwardMouseWheelToParent = true; TextBox textBox = (TextBox)widget.findWidget("TextBox"); textBox.Caption = property.getValue(0); textBox.ForwardMouseWheelToParent = true; if (textBox.ClientWidget != null) { textBox.ClientWidget.ForwardMouseWheelToParent = true; } editBox = (EditBox)widget.findWidget("EditBox"); editBox.OnlyText = property.getValue(1); editBox.ForwardMouseWheelToParent = true; if (property.readOnly(1)) { editBox.EditReadOnly = true; } else { editBox.KeyLostFocus += new MyGUIEvent(editBox_KeyLostFocus); editBox.EventEditSelectAccept += new MyGUIEvent(editBox_EventEditSelectAccept); } Button browseButton = (Button)widget.findWidget("Browse"); browseButton.ForwardMouseWheelToParent = true; browseButton.MouseButtonClick += new MyGUIEvent(browseButton_MouseButtonClick); }
private void Label_MouseDoubleClick(object sender, MouseButtonEventArgs e) { Label.Visibility = Visibility.Hidden; EditBox.Visibility = Visibility.Visible; EditBox.Focus(); }
public SearchPanel(Widget rootWidget) { PanelWidget = rootWidget; scrollView = new ThemedScrollView(); RootWidget = new Frame { Id = "SearchPanel", Padding = new Thickness(4), Layout = new VBoxLayout { Spacing = 4 }, Nodes = { (searchStringEditor = new ThemedEditBox()), scrollView } }; resultPane = scrollView.Content; RootWidget.AddChangeWatcher(() => searchStringEditor.Text, RefreshResultPane); scrollView.TabTravesable = new TabTraversable(); resultPane.CompoundPresenter.Insert(0, new DelegatePresenter <Widget>(w => { w.PrepareRendererState(); if (scrollView.IsFocused() && results.Count > 0) { Renderer.DrawRect( 0, rowHeight * selectedIndex, w.Width, (selectedIndex + 1) * rowHeight, Theme.Colors.SelectedBackground); } })); scrollView.LateTasks.Add(new KeyRepeatHandler(ScrollView_KeyRepeated)); }
public SavePatientDialog(GUIManager guiManager) : base("DentalSim.GUI.FileManagement.SavePatientDialog.layout", guiManager) { firstText = widget.findWidget("Save/FirstName") as EditBox; lastText = widget.findWidget("Save/LastName") as EditBox; fileNameTextBox = widget.findWidget("Save/Filename") as EditBox; locationTextBox = widget.findWidget("Save/Location") as EditBox; warningLabel = widget.findWidget("Save/WarningLabel") as TextBox; warningImage = widget.findWidget("Save/WarningImage") as ImageBox; saveButton = widget.findWidget("Save/SaveButton") as Button; cancelButton = widget.findWidget("Save/CancelButton") as Button; Button browseButton = widget.findWidget("Save/BrowseButton") as Button; dataPanel = widget.findWidget("DataPanel"); lastText.EventEditTextChange += new MyGUIEvent(lastText_EventEditTextChange); firstText.EventEditTextChange += new MyGUIEvent(firstText_EventEditTextChange); fileNameTextBox.EventEditTextChange += new MyGUIEvent(fileNameTextBox_EventEditTextChange); locationTextBox.EventEditTextChange += new MyGUIEvent(locationTextBox_EventEditTextChange); warningLabel.Visible = false; warningImage.Visible = false; saveButton.MouseButtonClick += new MyGUIEvent(saveButton_MouseButtonClick); cancelButton.MouseButtonClick += new MyGUIEvent(cancelButton_MouseButtonClick); browseButton.MouseButtonClick += new MyGUIEvent(browseButton_MouseButtonClick); this.Shown += new EventHandler(SavePatientDialog_Shown); if (!PlatformConfig.AllowCustomSaveLoadPath) { locationTextBox.Visible = false; browseButton.Visible = false; widget.findWidget("Save/LocationText").Visible = false; } }
public ShortcutPropertyEditor(IPropertyEditorParams editorParams) : base(editorParams) { editor = editorParams.EditBoxFactory(); editor.Updating += Updating; editor.Updated += Updated; editor.LayoutCell = new LayoutCell(Alignment.Center); editor.AddChangeLateWatcher(CoalescedPropertyValue(), v => { var text = v.Value.ToString(); editor.Text = v.IsDefined ? v.Value.Main != Key.Unknown ? text : text.Replace("Unknown", "") : ManyValuesText; }); editor.IsReadOnly = true; editor.TextWidget.Tasks.Clear(); editor.TextWidget.Position = new Vector2(0, editor.MinHeight / 2); editor.TextWidget.Padding = new Thickness(5, 0); editor.Gestures.Add(new ClickGesture(() => editor.SetFocus())); editor.Gestures.Add(new ClickGesture(1, () => { main = Key.Unknown; modifiers = Modifiers.None; SetValue(new Shortcut(modifiers, main)); })); editor.AddToNode(EditorContainer); PropertyLabel.Tasks.Clear(); PropertyLabel.Tasks.Add(ManageLabelFocus()); ContainerWidget.Tasks.Add(ManageFocusTask()); var value = CoalescedPropertyValue().GetValue(); main = value.Value.Main; modifiers = value.Value.Modifiers; flatFillPresenter = new WidgetFlatFillPresenter(Theme.Colors.GrayBackground); ContainerWidget.CompoundPresenter.Add(flatFillPresenter); }
/////////////////////////////////////////// protected override void OnAttach() { base.OnAttach(); //create window window = ControlDeclarationManager.Instance.CreateControl( "Gui\\RegisterWindow.gui"); Controls.Add(window); MouseCover = true; BackColor = new ColorValue(0, 0, 0, .5f); RealName = (EditBox)window.Controls["RealName"]; UserName = (EditBox)window.Controls["UserName"]; //Age = (EditBox)window.Controls["Age"]; //OfAge = (CheckBox)window.Controls["OfAge"]; Pass1 = (PasswordBox)window.Controls["Pass1"]; Pass2 = (PasswordBox)window.Controls["Pass2"]; Email = (EditBox)window.Controls["Email"]; ((Button)window.Controls["Exit"]).Click += Exit_Click; ((Button)window.Controls["Register"]).Click += Register_Click; ((Button)window.Controls["Cancel"]).Click += Cancel_Click; }
private void InitializeComponent() { this.TitleTextBox = new EditBox(); this.label2 = new FocusLabel(); base.SuspendLayout(); this.TitleTextBox.LoadingBegin(); this.TitleTextBox.Location = new Point(72, 48); this.TitleTextBox.Name = "TitleTextBox"; this.TitleTextBox.PropertyName = "Text"; this.TitleTextBox.Size = new Size(144, 20); this.TitleTextBox.TabIndex = 0; this.TitleTextBox.LoadingEnd(); this.label2.LoadingBegin(); this.label2.FocusControl = this.TitleTextBox; this.label2.Location = new Point(43, 50); this.label2.Name = "label2"; this.label2.Size = new Size(29, 15); this.label2.Text = "Text"; this.label2.LoadingEnd(); base.Controls.Add(this.TitleTextBox); base.Controls.Add(this.label2); base.Name = "ScaleDiscreetItemEditorPlugIn"; base.Size = new Size(224, 112); base.ResumeLayout(false); }
public void BindInputFiledValueChanged(UnityAction <string, int> onValueChanged) { if (onValueChanged == null) { return; } InputField input = this.GetComponent <InputField>(); if (input == null) { return; } #if UNITY_EDITOR input.onValueChanged.AddListener((text) => { int caret = input.caretPosition; onValueChanged(text, caret == 0 ? text.Length : caret);//光标为零,说明已经失去焦点,是从聊天表情那里添加的,默认加到结尾 }); #else EditBox edb = this.GetComponent <EditBox>(); if (edb != null) { edb.onTextChange = onValueChanged; } #endif }
private void InitializeComponent() { this.ReferenceTextBox = new EditBox(); this.focusLabel6 = new FocusLabel(); base.SuspendLayout(); this.ReferenceTextBox.LoadingBegin(); this.ReferenceTextBox.Location = new Point(96, 32); this.ReferenceTextBox.Name = "ReferenceTextBox"; this.ReferenceTextBox.PropertyName = "Reference"; this.ReferenceTextBox.Size = new Size(56, 20); this.ReferenceTextBox.TabIndex = 0; this.ReferenceTextBox.LoadingEnd(); this.focusLabel6.LoadingBegin(); this.focusLabel6.FocusControl = this.ReferenceTextBox; this.focusLabel6.Location = new Point(38, 34); this.focusLabel6.Name = "focusLabel6"; this.focusLabel6.Size = new Size(58, 15); this.focusLabel6.Text = "Reference"; this.focusLabel6.LoadingEnd(); base.Controls.Add(this.ReferenceTextBox); base.Controls.Add(this.focusLabel6); base.Location = new Point(10, 20); base.Name = "PlotChannelBiFillSpecificEditorPlugIn"; base.Size = new Size(728, 328); base.ResumeLayout(false); }
// protected override void OnAttach() { base.OnAttach(); //load the HUD screen hudControl = ControlDeclarationManager.Instance.CreateControl( "Demos\\JigsawPuzzleGame\\JigsawPuzzleGameHUD.gui" ); //attach the HUD screen to the this window Controls.Add( hudControl ); if( EntitySystemWorld.Instance.IsSingle() ) { //hide chat edit box for single mode hudControl.Controls[ "ChatText" ].Visible = false; hudControl.Controls[ "ChatMessage" ].Visible = false; } //ExitToRooms button if( EntitySystemWorld.Instance.IsSingle() ) { ( (Button)hudControl.Controls[ "ExitToRooms" ] ).Click += delegate( Button sender ) { string mapName = "Maps\\MainDemo\\Map.map"; string spawnPointName = "SpawnPoint_FromJigsawPuzzleGame"; GameWorld.Instance.SetShouldChangeMap( mapName, spawnPointName, null ); }; } else hudControl.Controls[ "ExitToRooms" ].Visible = false; chatMessageEditBox = (EditBox)hudControl.Controls[ "ChatMessage" ]; chatMessageEditBox.PreKeyDown += ChatMessageEditBox_PreKeyDown; //find first map camera foreach( Entity entity in Map.Instance.Children ) { mapCamera = entity as MapCamera; if( mapCamera != null ) break; } //for chat support GameNetworkServer server = GameNetworkServer.Instance; if( server != null ) server.ChatService.ReceiveText += Server_ChatService_ReceiveText; GameNetworkClient client = GameNetworkClient.Instance; if( client != null ) client.ChatService.ReceiveText += Client_ChatService_ReceiveText; }
static void Main(string[] args) { EditBox edit = new EditBox(); IDataBound bound = edit as IDataBound; if (bound != null) { Console.WriteLine("IDataBound is supported..."); bound.Serialize(); } else { Console.WriteLine("IDataBound is NOT supported..."); } Console.ReadLine(); }
/////////////////////////////////////////// protected override void OnAttach() { base.OnAttach(); //disable check for disconnection GameEngineApp.Instance.Client_AllowCheckForDisconnection = false; //register config fields EngineApp.Instance.Config.RegisterClassParameters( GetType() ); //create window window = ControlDeclarationManager.Instance.CreateControl( "Gui\\MultiplayerLoginWindow.gui" ); Controls.Add( window ); MouseCover = true; BackColor = new ColorValue( 0, 0, 0, .5f ); //initialize controls buttonCreateServer = (Button)window.Controls[ "CreateServer" ]; buttonCreateServer.Click += CreateServer_Click; buttonConnect = (Button)window.Controls[ "Connect" ]; buttonConnect.Click += Connect_Click; ( (Button)window.Controls[ "Exit" ] ).Click += Exit_Click; //generate user name if( string.IsNullOrEmpty( userName ) ) { EngineRandom random = new EngineRandom(); userName = "******" + random.Next( 1000 ).ToString( "D03" ); } editBoxUserName = (EditBox)window.Controls[ "UserName" ]; editBoxUserName.Text = userName; editBoxUserName.TextChange += editBoxUserName_TextChange; editBoxConnectTo = (EditBox)window.Controls[ "ConnectTo" ]; editBoxConnectTo.Text = connectToAddress; editBoxConnectTo.TextChange += editBoxConnectTo_TextChange; SetInfo( "", false ); }
/////////////////////////////////////////// protected override void OnAttach() { base.OnAttach(); //create window window = ControlDeclarationManager.Instance.CreateControl( "Gui\\GUISamples3Window.gui" ); Controls.Add( window ); addressEditBox = (EditBox)window.Controls[ "Address" ]; addressEditBox.PreKeyDown += addressEditBox_PreKeyDown; webBrowserControl = (Engine.UISystem.WebBrowserControl)window.Controls[ "WebBrowser" ]; ( (Button)window.Controls[ "Close" ] ).Click += Close_Click; ( (Button)window.Controls[ "Go" ] ).Click += go_Click; BackColor = new ColorValue( 0, 0, 0, .5f ); MouseCover = true; }
protected override void OnAttach() { window = ControlDeclarationManager.Instance.CreateControl("Gui\\MPAKlobbyWindow.gui"); Controls.Add(window); //positionY = maxout; listBox = (ListBox)window.Controls["Servers"]; ((Button)window.Controls["Quit"]).Click += delegate(Button sender) { SetShouldDetach();// Back(true); }; //positionY = maxout; ((Button)window.Controls["TechLab"]).Click += delegate(Button sender) { this.OnDetach(); Controls.Add(new TechLabUnitBuyWindow()); }; ((Button)window.Controls["Refresh"]).Click += delegate(Button sender) { refreshlistbox(); }; ((Button)window.Controls["Customize"]).Click += delegate(Button sender) { this.OnDetach(); Controls.Add(new TechLabUnitCustomizeWindow()); }; //Run button event handler ((Button)window.Controls["Run"]).Click += delegate(Button sender) { if (listBox.SelectedIndex != -1) RunMap(AKSERVERS[listBox.SelectedIndex]); }; createServerPort = window.Controls["Serverport"] as EditBox; if (createServerPort != null) { createServerPort.TextChange += delegate(Control sender) { createServerPort.TextChange += createServerPort_TextChange; }; createserverport = int.Parse(createServerPort.Text.Trim()); } PassBox = window.Controls["passwordBox"] as PasswordBox; if (PassBox != null) { PassBox.TextChange += delegate(Control sender) { PassBox.TextChange += PassBox_TextChange; if (PassBox.Text.Length > 0) { clientpassword = PassBox.Text.Trim(); serverpassword = clientpassword; } else { clientpassword = serverpassword = ""; } }; } CheckPrivate = window.Controls["chkserverPrivate"] as CheckBox; if (CheckPrivate != null) { CheckPrivate.CheckedChange += delegate(CheckBox sender) { if (CheckPrivate.Checked == true) { privateserver = true; SetInfo("Server set to private", false); } else { privateserver = false; } }; } EditBox IPtext = window.Controls["DirectConnectionTextBox"] as EditBox; ((Button)window.Controls["DirectIPCon"]).Click += delegate(Button sender) { GameNetworkClient client = new GameNetworkClient(true); client.ConnectionStatusChanged += Client_ConnectionStatusChanged; string error; if (!client.BeginConnect(IPtext.Text.ToString(), int.Parse(createserverport.ToString()), EngineVersionInformation.Version, Program.username, clientpassword, out error)) { Log.Error(error); DisposeClient(); return; } }; ((Button)window.Controls["singlePlayer"]).Click += delegate(Button sender) { GameEngineApp.Instance.SetNeedMapLoad("Maps\\MainDemo\\Map.map"); }; //TextBox ComWelN = window.Controls["ComWelNote"] as TextBox; //if (ComWelN != null) //{ // ComWelN.Text = "Welcome Commander " + MySqlGetUserName(); //} buttonCreateServer = (Button)window.Controls["CreateServer"]; buttonCreateServer.Click += CreateServer_Click; //refreshlistbox(); base.OnAttach(); }
static void Main(string[] args) { EditBox edit = new EditBox(); edit.Serialize(); Console.ReadLine(); }
static void box_EventEditTextChange(EditBox _sender) { Export.DebugOut("EventEditTextChange"); }
static void box_EventEditSelectAccept(EditBox _sender) { Export.DebugOut("EventEditSelectAccept"); }
protected override void OnTick(float delta) { base.OnTick(delta); TickAKunitCamera(delta); //chatshit if (chatMessageEditBox != null) { chatMessageEditBox = hudControl.Controls["Game/ChatMessage"] as EditBox; chatMessageEditBox.PreKeyDown += ChatMessageEditBox_PreKeyDown; if (EntitySystemWorld.Instance.IsSingle()) { //hide chat edit box for single mode if (hudControl.Controls["ChatText"] != null) hudControl.Controls["ChatText"].Visible = false; if (hudControl.Controls["Game/ChatMessage"] != null) hudControl.Controls["Game/ChatMessage"].Visible = false; } if (!chatfirstclean && chatMessageEditBox.Text == "j") { chatMessageEditBox.Text = ""; chatfirstclean = true; } } //NeedWorldDestroy if (GameWorld.Instance.NeedWorldDestroy) { if (EntitySystemWorld.Instance.IsServer() || EntitySystemWorld.Instance.IsSingle()) EntitySystemWorld.Instance.Simulation = false; MapSystemWorld.MapDestroy(); EntitySystemWorld.Instance.WorldDestroy(); GameEngineApp.Instance.Server_DestroyServer("The server has been destroyed"); GameEngineApp.Instance.Client_DisconnectFromServer(); //close all windows foreach (Control control in GameEngineApp.Instance.ControlManager.Controls) control.SetShouldDetach(); //create main menu GameEngineApp.Instance.ControlManager.Controls.Add(new MainMenuWindow()); return; } //If atop openly any window to not process if (Controls.Count != 1) return; if (GameEngineApp.Instance.ControlManager.IsControlFocused()) return; //update mouse relative mode { //!!!!!!mb not here if (GetRealCameraType() == CameraType.Free && !FreeCameraMouseRotating) EngineApp.Instance.MouseRelativeMode = false; if (EntitySystemWorld.Instance.Simulation && GetRealCameraType() != CameraType.Free) EngineApp.Instance.MouseRelativeMode = true; if (GameEngineApp.Instance.ControlManager != null && GameEngineApp.Instance.ControlManager.IsControlFocused()) EngineApp.Instance.MouseRelativeMode = false; } if (GetRealCameraType() == CameraType.TPS && !IsCutSceneEnabled() && !EngineConsole.Instance.Active) { Range distanceRange = new Range(2, 200); Range centerOffsetRange = new Range(0, 10); float cameraDistance; float cameraCenterOffset; if (IsPlayerUnitVehicle()) { cameraDistance = tpsVehicleCameraDistance; cameraCenterOffset = tpsVehicleCameraCenterOffset; } else { cameraDistance = tpsCameraDistance; cameraCenterOffset = tpsCameraCenterOffset; } if (EngineApp.Instance.IsKeyPressed(EKeys.PageUp)) { cameraDistance -= delta * distanceRange.Size() / 20.0f; if (cameraDistance < distanceRange[0]) cameraDistance = distanceRange[0]; } if (EngineApp.Instance.IsKeyPressed(EKeys.PageDown)) { cameraDistance += delta * distanceRange.Size() / 20.0f; if (cameraDistance > distanceRange[1]) cameraDistance = distanceRange[1]; } if (EngineApp.Instance.IsKeyPressed(EKeys.Home)) { cameraCenterOffset += delta * centerOffsetRange.Size() / 4.0f; if (cameraCenterOffset > centerOffsetRange[1]) cameraCenterOffset = centerOffsetRange[1]; } if (EngineApp.Instance.IsKeyPressed(EKeys.End)) { cameraCenterOffset -= delta * centerOffsetRange.Size() / 4.0f; if (cameraCenterOffset < centerOffsetRange[0]) cameraCenterOffset = centerOffsetRange[0]; } if (IsPlayerUnitVehicle()) { tpsVehicleCameraDistance = cameraDistance; tpsVehicleCameraCenterOffset = cameraCenterOffset; } else { tpsCameraDistance = cameraDistance; tpsCameraCenterOffset = cameraCenterOffset; } } //GameControlsManager if (EntitySystemWorld.Instance.Simulation) { if (GetRealCameraType() != CameraType.Free && !IsCutSceneEnabled()) GameControlsManager.Instance.DoTick(delta); } { for (int n = 0; n < screenMessages.Count; n++) { screenMessages[n].timeRemaining -= delta; if (screenMessages[n].timeRemaining <= 0) { screenMessages.RemoveAt(n); n--; } } } //FindNearFlag(); }
private void InstallEditBox(EditBox editBox) { if (this.Graphic.ParentPresentationImage != null) { if (this.Graphic.ParentPresentationImage.Tile != null) this.Graphic.ParentPresentationImage.Tile.EditBox = editBox; } }
/// <summary> /// Ends edit mode on the callout graphic if it is currently being edited. Has no effect otherwise. /// </summary> public void EndEdit() { if (_currentCalloutEditBox != null) { _currentCalloutEditBox.ValueAccepted -= OnEditBoxComplete; _currentCalloutEditBox.ValueCancelled -= OnEditBoxComplete; _currentCalloutEditBox = null; } InstallEditBox(null); }
protected override void OnAttach() { base.OnAttach(); window = ControlDeclarationManager.Instance.CreateControl("Gui\\TechLabUnitCustomizeWindow.gui"); Controls.Add(window); if (spawner == null) spawner = Entities.Instance.GetByName("TechlabMechSpawn") as Spawner; else spawner = Entities.Instance.GetByName("TechlabMechSpawn") as Spawner; if (camera == null) camera = Entities.Instance.GetByName("TechlabCam") as MapCamera; else camera = Entities.Instance.GetByName("TechlabCam") as MapCamera; //declare controls btnMechs = (Button)window.Controls["Mechs"]; btnMechs.Click += new Button.ClickDelegate(btnMechs_Click); btnGroundUnits = (Button)window.Controls["Gunit"]; btnGroundUnits.Click += new Button.ClickDelegate(btnGroundUnits_Click); btnAirUnits = (Button)window.Controls["Aunit"]; btnAirUnits.Click += new Button.ClickDelegate(btnAirUnits_Click); btnJets = (Button)window.Controls["Junit"]; btnJets.Click += new Button.ClickDelegate(btnJets_Click); btnNext = (Button)window.Controls["Next"]; btnNext.Click += new Button.ClickDelegate(btnNext_Click); btnPrevious = (Button)window.Controls["Previous"]; btnPrevious.Click += new Button.ClickDelegate(btnPrevious_Click); btnRA = (Button)window.Controls["RA"]; btnRA.Click += new Button.ClickDelegate(btnRA_Click); btnRT = (Button)window.Controls["RT"]; btnRT.Click += new Button.ClickDelegate(btnRT_Click); btnCT = (Button)window.Controls["CT"]; btnCT.Click += new Button.ClickDelegate(btnCT_Click); btnLT = (Button)window.Controls["LT"]; btnLT.Click += new Button.ClickDelegate(btnLT_Click); btnLA = (Button)window.Controls["LA"]; btnLA.Click += new Button.ClickDelegate(btnLA_Click); //iNCIN -- SlotList cbxWeaponSlots = (ListBox)window.Controls["SlotList"]; cbxWeaponSlots.SelectedIndexChange += new ListBox.SelectedIndexChangeDelegate(cbxWeaponSlots_SelectedIndexChange); cbxVariantList = (ListBox)window.Controls["VariantList"]; cbxVariantList.SelectedIndexChange += new ListBox.SelectedIndexChangeDelegate(cbxVariantList_SelectedIndexChange); lstWeaponList = (ListBox)window.Controls["WeaponList"]; lstWeaponList.SelectedIndexChange += new ListBox.SelectedIndexChangeDelegate(lstWeaponList_SelectedIndexChange); btnAddWeapon = (Button)window.Controls["AddWeapon"]; btnAddWeapon.Click += new Button.ClickDelegate(btnAddWeapon_Click); txtWeaponInfo = (EditBox)window.Controls["WeaponInfo"]; txtCash = (TextBox)window.Controls["Cash"]; btnSaveVariant = (Button)window.Controls["SaveCustomUnit"]; btnSaveVariant.Click += new Button.ClickDelegate(btnSaveVariant_Click); btnExit = (Button)window.Controls["Quit"]; btnExit.Click += new Button.ClickDelegate(btnExit_Click); txtUnitName = (TextBox)window.Controls["UnitName"]; MechsPriceList = (PriceListC)Entities.Instance.Create("MechPriceList", Map.Instance); AunitPriceList = (PriceListC)Entities.Instance.Create("AunitPriceList", Map.Instance); GunitPriceList = (PriceListC)Entities.Instance.Create("GunitPriceList", Map.Instance); JunitPriceList = (PriceListC)Entities.Instance.Create("JunitPriceList", Map.Instance); GetListOfPlayerUnits(); cash = GetPlayerCashSQL(); if (MechDBUnits.Count == 0) btnMechs.Enable = false; if (ADBUnits.Count == 0) btnAirUnits.Enable = false; if (GDBUnits.Count == 0) btnGroundUnits.Enable = false; if (JDBUnits.Count == 0) btnJets.Enable = false; if (MechDBUnits.Count == 0 || ADBUnits.Count == 0 || GDBUnits.Count == 0 || JDBUnits.Count == 0) { //player has not bought any units Log.Info("No units purchased. TODO: ask user if they want to go to buy window"); } InitCameraViewFromTarget(); //positionY = maxout; spawner.UnitSpawned += new Spawner.OnUnitSpawned(spawner_UnitSpawned); }
/////////////////////////////////////////// protected override void OnAttach() { base.OnAttach(); //disable check for disconnection GameEngineApp.Instance.Client_AllowCheckForDisconnection = false; //register config fields EngineApp.Instance.Config.RegisterClassParameters(GetType()); //create window window = ControlDeclarationManager.Instance.CreateControl( "Gui\\MultiplayerLoginWindow.gui"); Controls.Add(window); //MouseCover = true; //BackColor = new ColorValue( 0, 0, 0, .5f ); //initialize controls buttonConnect = (Button)window.Controls["Connect"]; buttonConnect.Click += Connect_Click; //( (Button)window.Controls[ "Exit" ] ).Click += Exit_Click; //Quit button event handler ((Button)window.Controls["Exit"]).Click += delegate(Button sender) { SetShouldDetach(); //Back(true); }; //positionY = maxout; //generate user name if (string.IsNullOrEmpty(userName)) { EngineRandom random = new EngineRandom(); userName = "******" + random.Next(1000).ToString("D03"); } savePass = (CheckBox)window.Controls["savePass"]; editBoxUserPass = (PasswordBox)window.Controls["password"]; if (!string.IsNullOrEmpty(password)) { editBoxUserPass.Text = password; savePass.Checked = true; } //configure password feature editBoxUserPass.UpdatingTextControl = delegate(EditBox sender, ref string text) { text = new string('*', sender.Text.Length); if (sender.Focused) text += "_"; savePass.Checked = true; }; //editBoxUserPass.TextChange += passwordEditBox_TextChange; savePass.CheckedChange += savePass_CheckedChange; editBoxUserPass.TextChange += editBoxUserPass_TextChange; editBoxUserName = (EditBox)window.Controls["UserName"]; editBoxUserName.Text = userName; editBoxUserName.TextChange += editBoxUserName_TextChange; ((Button)window.Controls["Register"]).Click += Register_Click; SetInfo("", false); }
private void InstallEditBox(EditBox editBox) { if (base.ParentPresentationImage != null) { if (base.ParentPresentationImage.Tile != null) base.ParentPresentationImage.Tile.EditBox = editBox; } }
/// <summary> /// Starts edit mode on the callout graphic by installing a <see cref="EditBox"/> on the /// <see cref="Tile"/> of the <see cref="Graphic.ParentPresentationImage">parent PresentationImage</see>. /// </summary> /// <returns>True if edit mode was successfully started; False otherwise.</returns> public bool StartEdit() { // remove any pre-existing edit boxes EndEdit(); bool result = false; this.CoordinateSystem = CoordinateSystem.Destination; try { EditBox editBox = new EditBox(this.Text ?? string.Empty); editBox.Location = Point.Round(this.Location); editBox.Size = Rectangle.Round(this.BoundingBox).Size; editBox.Multiline = this.Multiline; editBox.FontName = this.FontName; editBox.FontSize = this.FontSize; editBox.ValueAccepted += OnEditBoxComplete; editBox.ValueCancelled += OnEditBoxComplete; InstallEditBox(_currentCalloutEditBox = editBox); result = true; } finally { this.ResetCoordinateSystem(); } return result; }
/////////////////////////////////////////// protected override void OnAttach() { base.OnAttach(); //register config fields EngineApp.Instance.Config.RegisterClassParameters(GetType()); //create window window = ControlDeclarationManager.Instance.CreateControl( "Gui\\MultiplayerLobbyWindow.gui"); Controls.Add(window); MouseCover = true; BackColor = new ColorValue(0, 0, 0, .5f); ((Button)window.Controls["Exit"]).Click += Exit_Click; buttonStart = (Button)window.Controls["Start"]; if (GameNetworkServer.Instance != null) buttonStart.Click += Start_Click; if (GameNetworkClient.Instance != null) buttonStart.Enable = false; listBoxUsers = (ListBox)window.Controls["Users"]; editBoxChatMessage = (EditBox)window.Controls["ChatMessage"]; editBoxChatMessage.PreKeyDown += editBoxChatMessage_PreKeyDown; editBoxChatMessage.MouseDown += delegate { editBoxChatMessage.Text = ""; }; checkBoxShowAIMaps = (CheckBox)window.Controls["ShowAIMaps"]; if (GameNetworkServer.Instance != null) { checkBoxShowAIMaps.CheckedChange += checkBoxShowAIMaps_CheckedChange; } else { checkBoxShowAIMaps.Enable = false; } //comboBoxMaps { listBoxMaps = (ListBox)window.Controls["Maps"]; if (GameNetworkServer.Instance != null) { //procedural map creation listBoxMaps.Items.Add(new MapItem(exampleOfProceduralMapCreationText, false, false)); if (lastMapName == exampleOfProceduralMapCreationText) listBoxMaps.SelectedIndex = listBoxMaps.Items.Count - 1; string[] mapList = VirtualDirectory.GetFiles("", "*.map", SearchOption.AllDirectories); foreach (string mapName in mapList) { //check for network support if (VirtualFile.Exists(string.Format("{0}\\NoNetworkSupport.txt", Path.GetDirectoryName(mapName)))) { continue; } if (mapName.Contains("Demo")) continue; if (checkBoxShowAIMaps.Checked == false && mapName.Contains("AI")) continue; bool recommended = mapName.Contains("NewAvalion") || mapName.Contains("MossHillSpikes"); //mapName.Contains( "DeathmatchDemo" ); listBoxMaps.Items.Add(new MapItem(mapName, recommended, true)); if (mapName == lastMapName) listBoxMaps.SelectedIndex = listBoxMaps.Items.Count - 1; } listBoxMaps.SelectedIndexChange += listBoxMaps_SelectedIndexChange; if (listBoxMaps.Items.Count != 0 && listBoxMaps.SelectedIndex == -1) listBoxMaps.SelectedIndex = 0; } else { ;//listBoxMaps.Enable = false; } } //checkBoxAllowToConnectDuringGame { checkBoxAllowToConnectDuringGame = (CheckBox)window.Controls[ "AllowToConnectDuringGame"]; if (GameNetworkServer.Instance != null) { checkBoxAllowToConnectDuringGame.CheckedChange += checkBoxAllowToConnectDuringGame_CheckedChange; } else { checkBoxAllowToConnectDuringGame.Enable = false; } } //server specific GameNetworkServer server = GameNetworkServer.Instance; if (server != null) { //for receive map name server.UserManagementService.AddUserEvent += Server_UserManagementService_AddUserEvent; //for chat support server.ChatService.ReceiveText += Server_ChatService_ReceiveText; } //client specific GameNetworkClient client = GameNetworkClient.Instance; if (client != null) { //for receive map name client.CustomMessagesService.ReceiveMessage += Client_CustomMessagesService_ReceiveMessage; //for chat support client.ChatService.ReceiveText += Client_ChatService_ReceiveText; AddMessage(string.Format("Connected to server: \"{0}\"", client.RemoteServerName)); foreach (string serviceName in client.ServerConnectedNode.RemoteServices) AddMessage(string.Format("Server service: \"{0}\"", serviceName)); } UpdateControls(); }
static void box_EventEditTextChange(EditBox _sender) { Gui.Instance.Log("TestApp", LogLevel.Info, "EventEditTextChange"); }
/// <summary> /// Constructor /// </summary> public ImageComboBox() { InitializeComponent(); DrawMode = DrawMode.OwnerDrawFixed; imageList = new ImageList(); editBox = new EditBox(this); SendMessage(editBox.Handle, EM_SETMARGINS, EC_LEFTMARGIN, 20); SendMessage(editBox.Handle, EM_SETMARGINS, EC_RIGHTMARGIN, 1000); }
static void box_EventEditSelectAccept(EditBox _sender) { Gui.Instance.Log("TestApp", LogLevel.Info, "EventEditSelectAccept"); }
static void box_EventEditSelectAccept(EditBox _sender) { ExampleApplication.DebugOut("EventEditSelectAccept"); }
/// <summary> /// Invokes an interactive edit box on the name of the graphic, allowing the user to assign a name to the <see cref="RoiGraphic"/>. /// </summary> public void Rename() { RoiGraphic parent = this.ParentGraphic; if (parent == null) return; this.CoordinateSystem = CoordinateSystem.Destination; try { EditBox editBox = new EditBox(parent.Name ?? string.Empty); editBox.Location = Point.Round(base.TextGraphic.Location); editBox.Size = Size.Round(base.TextGraphic.BoundingBox.Size); editBox.FontName = base.TextGraphic.Font; editBox.FontSize = base.TextGraphic.SizeInPoints; editBox.Multiline = false; editBox.ValueAccepted += OnEditBoxAccepted; editBox.ValueCancelled += OnEditBoxCancelled; base.ParentPresentationImage.Tile.EditBox = editBox; } finally { this.ResetCoordinateSystem(); } }
static void box_EventEditTextChange(EditBox _sender) { ExampleApplication.DebugOut("EventEditTextChange"); }
protected override void OnAttach() { if (variant == null) return; base.OnAttach(); window = ControlDeclarationManager.Instance.CreateControl("Gui\\VariantSaveWindow.gui"); Controls.Add(window); btnSaveVariant = (Button)window.Controls["SaveVariant"]; btnBack = (Button)window.Controls["Back"]; txtVariantName = (EditBox)window.Controls["VariantName"]; txtInfo = (TextBox)window.Controls["Info"]; txtInfo.Text = "Total Cost of Variant: " + cost.ToString(); btnBack.Click += new Button.ClickDelegate(btnBack_Click); lstWeaponList = (ListBox)window.Controls["WeaponList"]; lstWeaponList.SelectedIndexChange += new ListBox.SelectedIndexChangeDelegate(lstWeaponList_SelectedIndexChange); txtWeaponGroup = (EditBox)window.Controls["Group"]; txtWeaponGroup.TextChange += new DefaultEventDelegate(txtWeaponGroup_TextChange); btnSaveVariant.Click += new Button.ClickDelegate(btnSaveVariant_Click); foreach (TextBlock childBlock in variant.Children) { foreach (TextBlock grandChildBlock in childBlock.Children) { VariantWeaponGroupItem vwgi = new VariantWeaponGroupItem(); vwgi.BodyPartName = childBlock.Name; vwgi.WeaponName = grandChildBlock.Name; MapObjectAttachedMapObject obj = spawned.GetFirstAttachedObjectByAlias(vwgi.WeaponName) as MapObjectAttachedMapObject; vwgi.AttachedMapObjectTypeName = obj.MapObject.Type.Name; vwgi.OldWeaponGroup = int.Parse(grandChildBlock.Attributes[1].Value); vwgi.NewWeaponGroup = vwgi.OldWeaponGroup; lstWeaponList.Items.Add(vwgi); } } }
private static Rectangle ComputeEditBoxControlBounds(Control control, EditBox editBox) { Size sz = control.GetPreferredSize(Size.Empty); sz = new Size(Math.Max(Math.Max(sz.Width, editBox.Size.Width), 50), Math.Max(Math.Max(sz.Height, editBox.Size.Height), 21)); return RectangleUtilities.ConvertToRectangle(editBox.Location, sz); }