本文整理汇总了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);
}
示例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;
}