public override void SetFocus() { base.SetFocus(); if (null != TextDisplay) { TextDisplay.SetFocus(); } }
//protected new void KeyDownHandler(Event e) //{ // KeyboardEvent ke = (KeyboardEvent)e; // switch (ke.KeyCode) // { // case KeyCode.UpArrow: // Value += _step; // break; // case KeyCode.DownArrow: // Value -= _step; // break; // } //} //protected override void CreateChildren() //{ // base.CreateChildren(); // TextDisplay.AlowedCharacters = Mode == NumericStepperMode.Int ? AlowedIntCharacters : AlowedFloatCharacters; // TextDisplay.Change += new EventHandler(OnTextChange); // TextDisplay.FocusOut += new EventHandler(OnTextBlur); // AddChild(TextDisplay); // //VBox vbox = new VBox {VerticalSpacing = 0}; // Container vbox = new Container // { // QLayout = new VerticalLayout {/*VerticalAlign = VerticalAlign.Middle*/} // }; // AddChild(vbox); // vbox.SendToBack(); // vbox.AddChild(_btnPlus); // vbox.AddChild(_btnMinus); //} //public override void StyleChanged(string styleName, object s) //{ // base.StyleChanged(styleName, s); // switch (styleName) // { // case "textFieldStyle": // TextField.SetStyle("textFieldStyle", s); // break; // case "plusButtonStyle": // _btnPlus.SetStyle("buttonStyle", s); // break; // case "minusButtonStyle": // _btnMinus.SetStyle("buttonStyle", s); // break; // } //} // private void OnTextChange(Event e) // { // TextFieldEvent tfe = (TextFieldEvent) e; // try { // Value = (float) (Mode == NumericStepperMode.Int ? Convert.ToInt32(tfe.NewText) : Convert.ToDouble(tfe.NewText)); // _valueChangedByEditor = true; // } // catch (Exception ex) // { // Debug.Log("Error: " + ex.Message); // } // } // private void OnTextBlur(Event e) // { // //TextDisplay.Text = Convert.ToString(_value); // } //private bool _valueChangedByEditor; #endregion public override void SetFocus() { //TextFieldFocusHelper.NextFocusId = TextDisplay.Uid; //base.SetFocus(); // TODO: do not set focus to text display // instead, just grab its underlying editor and focus it at lower level //Debug.Log("TextDisplay.Uid: " + TextDisplay.Uid); //TextFieldFocusHelper.NextFocusId = TextDisplay.Uid; //GUI.FocusControl(TextDisplay.Uid); TextDisplay.SetFocus(); }
override protected void CreateChildren() { base.CreateChildren(); #region Controls Toolbar toolbar = new Toolbar(); toolbar.Plugins.Add(new TabManager { ArrowsEnabled = true }); AddChild(toolbar); #region Text field _txtSearch = new TextField { StyleName = "search", Text = "croatian coast", FocusEnabled = true, Width = 400 }; _txtSearch.SetFocus(); _txtSearch.KeyUp += delegate(Event e) { KeyboardEvent ke = (KeyboardEvent)e; if (ke.KeyCode == KeyCode.Return) { _newSearch = true; Search(); } }; toolbar.AddContentChild(_txtSearch); #endregion Button btnLoad = new Button { Text = "Load data", SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/arrow_refresh"), AutoRepeat = true }; btnLoad.ButtonDown += delegate { Search(); btnLoad.Text = "Load more..."; }; toolbar.AddContentChild(btnLoad); Button btnClear = new Button { Text = "Remove all", SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/cancel"), AutoRepeat = true }; btnClear.ButtonDown += delegate { _scroller.Visible = false; _dataProvider.RemoveAll(); btnLoad.Text = "Load data"; }; toolbar.AddContentChild(btnClear); #endregion #region Lower group Group group = new Group { PercentWidth = 100, PercentHeight = 100 }; AddChild(group); #endregion #region Title label Label label = new TitleLabel { HorizontalCenter = 0, VerticalCenter = 0, StyleName = "title" }; group.AddChild(label); new TextRotator { Delay = 5, // 5 seconds delay Lines = new[] { "Load Data Demo", "Created with eDriven.Gui", "Loads images from Flickr"/*, "Author: Danko Kozar"*/ }, Callback = delegate(string line) { label.Text = line; } } .Start(); #endregion #region Scroller / viewport _scroller = new Scroller { SkinClass = typeof (ScrollerSkin2), PercentWidth = 100, PercentHeight = 100, Visible = false }; _scroller.SetStyle("showEffect", _scrollerShow); group.AddChild(_scroller); Group viewport = new Group { /*MouseEnabled = true, Layout = new VerticalLayout { HorizontalAlign = HorizontalAlign.Left, PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10, Gap = 10 }*/ }; _scroller.Viewport = viewport; #endregion #region Data controls List<object> source = new List<object>(); _dataProvider = new ArrayList(source); /* LISTS */ #region HGroup #endregion #region List _list = new List { Left = 10, Right = 10, Top = 10, Bottom = 10, Layout = new TileLayout { HorizontalGap = 0, VerticalGap = 0/*, RequestedRowCount = 4, RequestedColumnCount = 3*/ }, DataProvider = _dataProvider, SkinClass = typeof(ListSkin2), ItemRenderer = new ItemRendererFactory<ThumbnailItemRenderer>(), LabelFunction = LabelFunction // extracting the title }; viewport.AddChild(_list); #endregion #endregion // bubbling event listener AddEventListener("showImage", ShowImageHandler); }