當前位置: 首頁>>代碼示例>>C#>>正文


C# Button.SetFocus方法代碼示例

本文整理匯總了C#中Xwt.Button.SetFocus方法的典型用法代碼示例。如果您正苦於以下問題:C# Button.SetFocus方法的具體用法?C# Button.SetFocus怎麽用?C# Button.SetFocus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Xwt.Button的用法示例。


在下文中一共展示了Button.SetFocus方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: WidgetFocus

		public WidgetFocus ()
		{
			var text = new TextEntry ();
			var check = new CheckBox ("CheckBox");
			var slider = new HSlider ();
			ListStore store = new ListStore (value);
			var list = new ListView (store);
			list.Columns.Add ("Value", value);
			list.HeadersVisible = false;
			for (int n=0; n<10; n++) {
				var r = store.AddRow ();
				store.SetValue (r, value, "Value " + n);
			}

			var btn1 = new Button ("TextEnty");
			var btn2 = new Button ("Checkbox");
			var btn3 = new Button ("Slider");
			var btn4 = new Button ("ListBox");
			var btn5 = new Button ("Button");

			btn1.Clicked += (sender, e) => text.SetFocus ();
			btn2.Clicked += (sender, e) => check.SetFocus ();
			btn3.Clicked += (sender, e) => slider.SetFocus ();
			btn4.Clicked += (sender, e) => list.SetFocus ();
			btn5.Clicked += (sender, e) => btn1.SetFocus ();

			var btnBox = new HBox ();
			btnBox.PackStart (btn1);
			btnBox.PackStart (btn2);
			btnBox.PackStart (btn3);
			btnBox.PackStart (btn4);
			btnBox.PackStart (btn5);

			var focusBox = new HBox ();
			var vbox = new VBox ();
			vbox.PackStart (text);
			vbox.PackStart (check);
			vbox.PackStart (slider);
			focusBox.PackStart (vbox);
			focusBox.PackStart (list, true);

			PackStart (btnBox);
			PackStart (focusBox, true);
		}
開發者ID:m13253,項目名稱:xwt,代碼行數:44,代碼來源:WidgetFocus.cs

示例2: Options

        public override Widget Options()
        {
            if (main != null) {
                main.Dispose();
            }

            main = new VBox();

            // filename
            HBox file = new HBox();
            filenameEntry = new TextEntry();
            filenameEntry.Text = Filename;
            filenameEntry.ReadOnly = true;
            filenameEntry.ShowFrame = false;
            filenameEntry.BackgroundColor = Color.FromBytes(232, 232, 232);

            Button browseButton = new Button("Browse...");
            browseButton.SetFocus();
            browseButton.Clicked += Browse;

            // print to std out
            HBox exportToStdOutBox = new HBox();
            CheckBox exportTSCheck = new CheckBox();

            exportToStdOutBox.PackStart(new Label("Export to standard out?"));
            exportToStdOutBox.PackEnd(exportTSCheck);
            exportTSCheck.Toggled += delegate {
                if (exportTSCheck.Active) {
                    browseButton.Style = ButtonStyle.Flat;
                    browseButton.Clicked -= Browse;
                    exportToStdOut = true;
                } else {
                    browseButton.Style = ButtonStyle.Normal;
                    browseButton.Clicked += Browse;
                    exportToStdOut = false;
                }
            };

            file.PackStart(filenameEntry, true);
            file.PackEnd(browseButton);

            main.PackEnd(file, true);
            main.PackEnd(exportToStdOutBox, true);

            return main;
        }
開發者ID:jfreax,項目名稱:BAIMP,代碼行數:46,代碼來源:Arff.cs


注:本文中的Xwt.Button.SetFocus方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。