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


C# Entry.AddEvents方法代码示例

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


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

示例1: rename_category

        public void rename_category(bool is_create)
        {
            Gtk.Entry rename_entry = new Gtk.Entry();
            rename_entry.Text = category.metalabel.label;
            rename_entry.Name = "rename_cat";
            rename_entry.AddEvents((int)Gdk.EventMask.KeyReleaseMask);
            rename_entry.KeyReleaseEvent += delegate (object sender, Gtk.KeyReleaseEventArgs e) {
                on_rename_cat_key_release(e, is_create);
            };

            int pos = 0;
            foreach (Widget w in representation) {
                if (w.Name == category.metalabel.label) {
                    w.Destroy();
                    break;
                } else
                    ++pos;
            }

            representation.PackStart(rename_entry, false, false, 6);
            representation.ReorderChild(rename_entry, pos);
            representation.ShowAll();

            rename_entry.GrabFocus();
        }
开发者ID:GNOME,项目名称:nemo,代码行数:25,代码来源:CategoryDrawer.cs

示例2: add_new_label

        private void add_new_label()
        {
            System.Console.WriteLine("writing new label");

            Gtk.Entry new_label = new Gtk.Entry();
            new_label.Name = "new_label";
            new_label.AddEvents((int)Gdk.EventMask.KeyReleaseMask);
            new_label.KeyReleaseEvent += on_new_key_release;

            representation.Add(new_label);
            representation.ShowAll();

            new_label.GrabFocus();
        }
开发者ID:GNOME,项目名称:nemo,代码行数:14,代码来源:CategoryDrawer.cs

示例3: rename_label

        private void rename_label(UserLabel label)
        {
            renamed_label = label;

            Gtk.Entry rename_label = new Gtk.Entry();
            rename_label.Text = label.metalabel.label;
            rename_label.Name = "rename_label";
            rename_label.AddEvents((int)Gdk.EventMask.KeyReleaseMask);
            rename_label.KeyReleaseEvent += on_rename_key_release;

            int pos = 0;
            foreach (Widget w in representation) {
                if (w.Name == label.metalabel.label) {
                    w.Destroy();
                    break;
                } else
                    ++pos;
            }

            representation.Add(rename_label);
            representation.ReorderChild(rename_label, pos);
            representation.ShowAll();

            rename_label.GrabFocus();
        }
开发者ID:GNOME,项目名称:nemo,代码行数:25,代码来源:CategoryDrawer.cs

示例4: setupWindow


//.........这里部分代码省略.........
            MenuItem Help = new MenuItem ("Help");
            Help.Submenu = HelpMenu;

            MenuItem AboutMenuItem = new MenuItem("About");
            HelpMenu.Append (AboutMenuItem);

            MainMenuBar.Append (File);
            MainMenuBar.Append (Gesture);
            MainMenuBar.Append (Points);
            MainMenuBar.Append (Help);

            /*********************End of menu bar components*********************/

            //Drawing area which is the core component of the application
            dArea = new DrawingArea ();
            dArea.SetSizeRequest (500, 500);

            //Horizontal box (4 sections) which contains all of the buttons along the
            //bottom of the window
            HBox ButtonHBox = new HBox (false, 6);

            /*********************Start of Buttons*********************/

            Button BtnCreateGesture = new Button ("Create");
            Button BtnRecognizeGesture = new Button ("Recognize");
            Button BtnClearScreen = new Button ("Clear");
            Button BtnRecordPoints = new Button ("Record points");
            Button BtnChangeColour = new Button ("Change colour");

            //Button functions
            BtnCreateGesture.Clicked += new EventHandler (createGesture);
            BtnRecognizeGesture.Clicked += new EventHandler (recognizeGesture);
            BtnClearScreen.Clicked += new EventHandler (clearScreen);
            BtnRecordPoints.Clicked += new EventHandler (recordPoints);
            BtnChangeColour.Clicked += changeColour;

            //Adding buttons to the current horizontal box
            ButtonHBox.PackStart (BtnCreateGesture, true, false, 0);
            ButtonHBox.PackStart (BtnRecognizeGesture, true, false, 0);
            ButtonHBox.PackStart (BtnClearScreen, true, false, 0);
            ButtonHBox.PackStart (BtnRecordPoints, true, false, 0);
            ButtonHBox.PackStart (BtnChangeColour, true, false, 0);
            /*********************End of Buttons*********************/

            //Status bar which shows the score and recognized gesture
            sBar = new Statusbar ();
            sBar.Push (1, "Ready");

            //Entry box for batch function name to be used on the files
            batchFunctionName = new Entry ("Recorded points function name");
            batchFunctionName.AddEvents (
                (int)Gdk.EventMask.ButtonPressMask
            );
            batchFunctionName.ButtonPressEvent += clearTextBox;

            //Adding all components to the Vertical box
            MainVBox.PackStart (MainMenuBar, false, false, 0);
            MainVBox.PackStart (dArea, false, false, 0);
            MainVBox.PackStart (ButtonHBox, false, false, 0);
            MainVBox.PackStart (batchFunctionName, false, false, 0);
            MainVBox.PackStart (sBar, false, false, 0);

            Add (MainVBox);

            ShowAll ();

            //Surface 'pattern' for area to be covered
            surface = new ImageSurface(Format.Argb32, 500, 500);

            //Adding mouse events to the drawing area and assigning functions
            dArea.AddEvents(
                //Mouse Related Events
                (int)Gdk.EventMask.PointerMotionMask
                |(int)Gdk.EventMask.ButtonPressMask
                |(int)Gdk.EventMask.ButtonReleaseMask
            );

            //Repaint the Canvas Internally.
            dArea.ExposeEvent += OnDrawingAreaExposed;
            //Do this on MousePress inside Area
            dArea.ButtonPressEvent += OnMousePress;
            //Do this on MouseReleased inside Area
            dArea.ButtonReleaseEvent += OnMouseRelease;
            //Do this if a Motion Occurs inside the Drawing Area
            dArea.MotionNotifyEvent += OnMouseMotion2;

            //Assigning close function to the window
            DeleteEvent += delegate { Application.Quit(); };

            //Checking to see if bool for using the dot function is true
            //And assigning the required function as the delegate's operation
            //Note: This will always be true, no current way to switch while
            //application is running, has not been needed as of yet
            if (isDot) {
                Painter = new DrawShape (DrawDot);
                myoPainter = new DrawShape (DrawDot);
            } else {
                Painter = new DrawShape (DrawLine);
            }
        }
开发者ID:justingruber,项目名称:Protractor,代码行数:101,代码来源:Launcher.cs


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