当前位置: 首页>>代码示例>>C#>>正文


C# Button.GrabFocus方法代码示例

本文整理汇总了C#中Gtk.Button.GrabFocus方法的典型用法代码示例。如果您正苦于以下问题:C# Button.GrabFocus方法的具体用法?C# Button.GrabFocus怎么用?C# Button.GrabFocus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk.Button的用法示例。


在下文中一共展示了Button.GrabFocus方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ItunesImportDialog

        public ItunesImportDialog()
            : base()
        {
            // TODO add Help button and dialog/tooltip

            Title = Catalog.GetString ("iTunes Importer");
            Resizable = false;
            ContentArea.BorderWidth = 8;
            ContentArea.Spacing = 8;

            Button cancel_button = new Button (Stock.Cancel);
            cancel_button.Clicked += delegate { Respond (ResponseType.Cancel); };
            cancel_button.ShowAll ();
            AddActionWidget (cancel_button, ResponseType.Cancel);
            cancel_button.CanDefault = true;
            cancel_button.GrabFocus ();
            DefaultResponse = ResponseType.Cancel;

            import_button = new Button ();
            import_button.Label = Catalog.GetString ("_Import");
            import_button.UseUnderline = true;
            import_button.Image = Image.NewFromIconName (Stock.Open, IconSize.Button);
            import_button.Clicked += delegate { Respond (ResponseType.Ok); };
            import_button.ShowAll ();
            AddActionWidget (import_button, ResponseType.Ok);

            VBox vbox = new VBox ();
            ratings = new CheckButton (Catalog.GetString ("Import song ratings"));
            ratings.Active = true;
            vbox.PackStart (ratings, false, false, 0);
            stats = new CheckButton (Catalog.GetString ("Import play statistics (playcount, etc.)"));
            stats.Active = true;
            vbox.PackStart (stats, false, false, 0);
            playlists = new CheckButton (Catalog.GetString ("Import playlists"));
            playlists.Active = true;
            vbox.PackStart (playlists, false, false, 0);

            PackCheckboxes (vbox);

            ContentArea.ShowAll ();
        }
开发者ID:knocte,项目名称:banshee,代码行数:41,代码来源:ItunesPlayerImportDialogs.cs

示例2: CreateButton

        Widget CreateButton(WelcomeButton b)
        {
            Button button;
            VBox box;
            Gtk.Image image;
            Gtk.Alignment alignment;
            Label label;

            if (b.Icon == null) {
                image = new Gtk.Image (
                    Helpers.Misc.LoadIcon (b.Name, StyleConf.WelcomeIconImageSize, 0));
            } else {
                image = new Gtk.Image (b.Icon.Value);
            }

            button = new Button ();
            button.Clicked += (sender, e) => (b.Func ());
            button.HeightRequest = StyleConf.WelcomeIconSize;
            button.WidthRequest = StyleConf.WelcomeIconSize;
            button.Add (image);
            if (buttonWidgets.Count == 0) {
                button.Realized += (sender, e) => button.GrabFocus ();
            }

            alignment = new Alignment (0.5f, 0.5f, 0.0f, 0.0f);
            alignment.Add (button);

            label = new Label (b.Text);
            label.ModifyFont (Pango.FontDescription.FromString ("Ubuntu 12"));
            label.LineWrap = true;
            label.LineWrapMode = Pango.WrapMode.Word;
            label.Justify = Justification.Center;
            sizegroup.AddWidget (label);

            box = new VBox (false, StyleConf.WelcomeIconsTextSpacing);
            box.PackStart (alignment, false, false, 0);
            box.PackStart (label, false, false, 0);

            box.Name = b.Name + "roundedbutton";

            return box;
        }
开发者ID:LongoMatch,项目名称:longomatch,代码行数:42,代码来源:WelcomePanel.cs

示例3: ShowAdd2Page


//.........这里部分代码省略.........

            Gtk.TreeIter iter;
            treeView.HeadersVisible = false;
            treeView.Selection.Mode = SelectionMode.Single;

            TreeViewColumn column = new TreeViewColumn ();
            column.Title = "Name";
            CellRendererToggle renderToggle = new CellRendererToggle ();
            column.PackStart (renderToggle, false);
            renderToggle.Activatable = true;
            column.AddAttribute (renderToggle, "active", (int)CmisTreeStore.Column.ColumnSelected);
            column.AddAttribute (renderToggle, "inconsistent", (int)CmisTreeStore.Column.ColumnSelectedThreeState);
            column.AddAttribute (renderToggle, "radio", (int)CmisTreeStore.Column.ColumnRoot);
            renderToggle.Toggled += delegate (object render, ToggledArgs args) {
                TreeIter iterToggled;
                if (! cmisStore.CmisStore.GetIterFromString (out iterToggled, args.Path))
                {
                    Console.WriteLine("Toggled GetIter Error " + args.Path);
                    return;
                }

                Node node = cmisStore.CmisStore.GetValue(iterToggled,(int)CmisTreeStore.Column.ColumnNode) as Node;
                if (node == null)
                {
                    Console.WriteLine("Toggled GetValue Error " + args.Path);
                    return;
                }

                RootFolder selectedRoot = repositories.Find (x => (x.Selected != false));
                Node parent = node;
                while (parent.Parent != null)
                {
                    parent = parent.Parent;
                }
                RootFolder root = parent as RootFolder;
                if (root != selectedRoot)
                {
                    selectedRoot.Selected = false;
                    cmisStore.UpdateCmisTree(selectedRoot);
                }

                if (node.Parent == null)
                {
                    node.Selected = true;
                }
                else
                {
                    if (node.Selected == false)
                    {
                        node.Selected = true;
                    }
                    else
                    {
                        node.Selected = false;
                    }
                }
                cmisStore.UpdateCmisTree(root);
            };
            CellRendererText renderText = new CellRendererText ();
            column.PackStart (renderText, false);
            column.SetAttributes (renderText, "text", (int)CmisTreeStore.Column.ColumnName);
            column.Expand = true;
            treeView.AppendColumn (column);

            treeView.AppendColumn ("Status", new StatusCellRenderer (), "text", (int)CmisTreeStore.Column.ColumnStatus);

            treeView.RowExpanded += delegate (object o, RowExpandedArgs args) {
                Node node = cmisStore.CmisStore.GetValue(args.Iter, (int)CmisTreeStore.Column.ColumnNode) as Node;
                Node parent = node;
                while (parent.Parent != null)
                {
                    parent = parent.Parent;
                }
                RootFolder root = parent as RootFolder;
                loader[root.Id].Load(node);
            };

            ScrolledWindow sw = new ScrolledWindow() {
                ShadowType = Gtk.ShadowType.In
            };
            sw.Add(treeView);

            layout_vertical.PackStart (new Label(""), false, false, 0);
            layout_vertical.PackStart (sw, true, true, 0);
            Add(layout_vertical);
            AddButton(back_button);
            AddButton(cancel_button);
            AddButton(continue_button);

            if (repositories.Count > 0)
            {
                continue_button.GrabDefault ();
                continue_button.GrabFocus ();
            }
            else
            {
                back_button.GrabDefault ();
                back_button.GrabFocus ();
            }
        }
开发者ID:emrul,项目名称:CmisSync,代码行数:101,代码来源:Setup.cs

示例4: ItunesMusicDirectoryDialog

        public ItunesMusicDirectoryDialog(string itunes_music_directory)
            : base()
        {
            Title = Catalog.GetString ("Locate iTunes Music Directory");
            DefaultHeight = 650;
            DefaultWidth = 814;

            Button cancel_button = new Button (Stock.Cancel);
            cancel_button.Clicked += delegate { Respond (ResponseType.Cancel); };
            cancel_button.ShowAll ();
            AddActionWidget (cancel_button, ResponseType.Cancel);
            cancel_button.CanDefault = true;
            cancel_button.GrabFocus ();

            Button ok_button = new Button (Stock.Ok);
            ok_button.Clicked += delegate { Respond (ResponseType.Ok); };
            ok_button.ShowAll ();
            AddActionWidget (ok_button, ResponseType.Ok);

            VBox vbox = new VBox ();
            vbox.BorderWidth = 8;
            vbox.Spacing = 10;

            HBox hbox = new HBox ();
            hbox.Spacing = 10;

            Image image = new Image (Stock.DialogWarning, IconSize.Dialog);
            hbox.PackStart (image, false, true, 0);

            Label message = new Label ();
            message.Markup = String.Format ("<b>{0}</b>", GLib.Markup.EscapeText(
                String.Format (Catalog.GetString(
                    "The iTunes library refers to your music directory as \"{0}\" but " +
                    "Banshee was not able to infer the location of this directory. Please locate it."),
                itunes_music_directory)));
            message.Justify = Justification.Left;
            message.WidthRequest = 750;
            message.LineWrap = true;
            hbox.PackStart (message, true, true, 0);

            vbox.PackStart (hbox, false, true, 0);

            chooser = new FileChooserWidget (FileChooserAction.SelectFolder);
            chooser.ShowAll ();
            vbox.PackStart (chooser, true, true, 0);

            ContentArea.PackStart (vbox, true, true, 0);

            DefaultResponse = ResponseType.Cancel;

            ContentArea.ShowAll ();
        }
开发者ID:knocte,项目名称:banshee,代码行数:52,代码来源:ItunesPlayerImportDialogs.cs

示例5: AddFeedDialog

        public AddFeedDialog()
            : base(WindowType.Toplevel)
        {
            Title = StringCatalog.AddFeedTitle;
            IconName = "add";

            DeleteEvent += OnCancel;

            Resizable = false;
            BorderWidth = 6;

            vbox = new VBox(false, 6);
            Add(vbox);
            hbox = new HBox(false, 6);

            vbox.PackStart(hbox);

            image = new Image(Stock.Add, IconSize.Dialog);
            hbox.PackStart(image);

            table = new Table(2, 3, false);
            table.RowSpacing = 6;
            hbox.PackEnd(table);

            label = new Label();
            label.Markup = StringCatalog.AddFeedMessage;
            table.Attach(label, 1, 2, 0, 1);

            entry = new Entry();
            entry.Activated += OnActivated;
            table.Attach(entry, 1, 2, 1, 2);

            bbox = new HButtonBox();
            bbox.Layout = ButtonBoxStyle.End;
            bbox.Spacing = 6;
            vbox.PackEnd(bbox);

            cancel_button = new Button(Stock.Cancel);
            cancel_button.Clicked += new EventHandler(OnCancel);
            bbox.PackStart(cancel_button);

            add_button = new Button(Stock.Add);
            add_button.Clicked += new EventHandler(OnAdd);
            add_button.GrabFocus();
            bbox.PackEnd(add_button);
        }
开发者ID:wfarr,项目名称:newskit,代码行数:46,代码来源:Summa.Gui.AddFeedDialog.cs


注:本文中的Gtk.Button.GrabFocus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。