示例#1
0
 private void OnClickAdd(object sender, EventArgs e)
 {
     TreeNode newnode = new TreeNode("new");
     treeView1.Nodes.Add(newnode);
     treeView1.LabelEdit = true;
     newnode.BeginEdit();
 }
 public void NewActor(Actor actor)
 {
     TreeNode node = new TreeNode("Actor");
     this.Nodes.Add(node);
     this.SelectedNode = node;
     node.BeginEdit();
 }
示例#3
0
 void treeElementRename_Click(object sender, EventArgs e)
 {
     if ((m_ContextMenuNode != null) &&
         (m_ContextMenuNode.Level >= 1))
     {
         m_ContextMenuNode.BeginEdit();
     }
 }
 // Add message template category button handler.
 private void buttonAddMessageTemplateCategory_Click(object sender, EventArgs e)
 {
     this.treeViewMessageTemplate.LabelEdit = true;
     TreeNode newNode = new TreeNode();
     newNode.Text = "新消息模板";
     this.treeViewMessageTemplate.Nodes.Add(newNode);
     this.treeViewMessageTemplate.SelectedNode = newNode;
     newNode.BeginEdit();
 }
 private void AddLabelOnClick(object sender, EventArgs e)
 {
     if (this.nodeMouseClickSelectedNode.Level == 0)
     {
         var treeNode = new TreeNode("NewHost");
         this.nodeMouseClickSelectedNode.Nodes.Add(treeNode);
         treeNode.ExpandAll();
         treeNode.BeginEdit();
     }
 }
示例#6
0
 private void RenamePOU_Click(object sender, EventArgs e)
 {
     if (tmpSelectedNode != null && tmpSelectedNode.Parent != null)
     {
         treeViewControl.SelectedNode = tmpSelectedNode;
         treeViewControl.LabelEdit    = true;
         if (!tmpSelectedNode.IsEditing)
         {
             tmpSelectedNode.BeginEdit();
         }
     }
 }
示例#7
0
        public static void AddNewSiteToTree(TreeView tree)
        {
            Site site = new Site{Name = "Site Name"};
            TreeNode siteNode = new TreeNode(site.Name);

            siteNode.Tag = site;
            siteNode.ContextMenuStrip = frmMain.StaticContextSite;
            tree.LabelEdit = true;
            tree.Nodes.Add(siteNode);

            if (!siteNode.IsEditing)
            {
                siteNode.BeginEdit();
            }
        }
        private void AddDictClass()
        {
            this.treeDict.LabelEdit = true;

            TreeNode newNode;
            newNode = new TreeNode();
            newNode.Name = this.treeDict.Nodes.Count.ToString ();
            newNode.Text = rm.GetString ("Label19");
            newNode.ImageIndex = 1;
            newNode.SelectedImageIndex = 1;
            this.treeDict.Nodes["nodDict"].Nodes.Add(newNode);
            //this.treeDict.SelectedNode =newNode ;
            newNode.BeginEdit();
            newNode = null;

            //this.listDict.Items.Clear();
        }
		public void BeforeLabelEditEventTest ()
		{
			tv.LabelEdit = true;

			TreeNode node = new TreeNode ("A");
			tv.Nodes.Add (node);

			tv.BeforeLabelEdit += new NodeLabelEditEventHandler (BeforeLabelEditHandler);

			f.Show ();

			node.BeginEdit ();
			Assert.IsTrue (node.IsEditing, "#A1");

			node.EndEdit (false);
			Assert.IsTrue (event_fired, "#B1");

			f.Dispose ();
		}
        private void AddLabelOnClick(object sender, EventArgs e)
        {
            if (this.IsAFrequency())
            {
                this.nodeMouseClickSelectedNode.ExpandAll();
                var treeNode = new TreeNode("120");
                this.nodeMouseClickSelectedNode.Nodes.Add(treeNode);
                //treeNode.ExpandAll();
                treeNode.BeginEdit();
                // this.nodeMouseClickSelectedNode.ExpandAll();
                //  this.nodeMouseClickSelectedNode.Parent.ExpandAll();
            }

            if (this.IsARole())
            {
                var treeNode = new TreeNode("NewRole");
                this.nodeMouseClickSelectedNode.Nodes.Add(treeNode);
                //treeNode.ExpandAll();
                treeNode.BeginEdit();
            }
        }
示例#11
0
        public static void AddNewNAEToTree(TreeView tree, TreeNode siteNode)
        {
            NAE nae = new NAE { Name = "New NAE" };
            TreeNode naeNode = new TreeNode(nae.Name);

            naeNode.Tag = nae;
            naeNode.ContextMenuStrip = frmMain.StaticContextNAE;

            if (!(siteNode.Tag is Site))
            {
                // Throw error
            }

            Site site = (Site)siteNode.Tag;
            site.NAEs.Add(nae);
            siteNode.Nodes.Add(naeNode);
            tree.LabelEdit = true;

            if (!naeNode.IsEditing)
            {
                naeNode.BeginEdit();
            }
        }
示例#12
0
		public void EndEditTest ()
		{
			TreeNode node1 = new TreeNode ("A");
			TreeNode node2 = new TreeNode ("B");

			Form f = new Form ();
			TreeView tv = new TreeView ();
			tv.LabelEdit = true;
			tv.Parent = f;
			tv.Nodes.Add (node1);
			tv.Nodes.Add (node2);

			f.Show ();

			// EndEdit called on a different node
			node1.BeginEdit ();
			Assert.AreEqual (true, node1.IsEditing, "#1");
			node2.EndEdit (false);
			Assert.AreEqual (false, node1.IsEditing, "#2");

			node1.BeginEdit ();
			Assert.AreEqual (true, node1.IsEditing, "#3");
			node2.EndEdit (true);
			Assert.AreEqual (false, node1.IsEditing, "#4");

			f.Dispose ();
		}
示例#13
0
文件: XTree.cs 项目: keithshort/HOPE
		/// <summary>
		/// Handles clicking on a node and either editing the label (double click) or
		/// calling the controller's Select method.
		/// </summary>
		/// <param name="e"></param>
		protected override void OnMouseDown(MouseEventArgs e)
		{
			base.OnMouseDown(e);
			selNode = GetNodeAt(e.Location);

			if (selNode != null)
			{
				if (e.Button == MouseButtons.Left)
				{
					if (e.Clicks == 2)
					{
						if (TreeDoubleClick != null)
						{
							TreeDoubleClick(this, EventArgs.Empty);
						}
					}

					// clicked twice on the same node?
					if (selNode == SelectedNode)
					{
						// Is writeable?
						if (!((NodeInstance)selNode.Tag).NodeDef.IsReadOnly)
						{
							// Not currently editing?
							if (!selNode.IsEditing)
							{
								// Then begin edit of the label.
								LabelEdit = true;
								selNode.BeginEdit();
							}
						}
						else
						{
							// Re-select the same node, in case we're binding to a property grid that has
							// displayed some other information, we now want to update any dependent controls.
							((NodeInstance)selNode.Tag).Instance.Select(selNode);
						}
					}
					else
					{
						// Clicked on a different node.  Select it and call
						// the controller's Select method.
						SelectedNode = selNode;
						((NodeInstance)selNode.Tag).Instance.Select(selNode);
					}
				}
				else
				{
					// Other mouse button.  Still select the node.
					SelectedNode = selNode;
					((NodeInstance)selNode.Tag).Instance.Select(selNode);
				}

				// Get the backing node instance of the selected node.
				selectedNodeInstance = ((NodeInstance)SelectedNode.Tag).Instance;
			}
		}
        private void btnNewRealm_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = treeServers.SelectedNode;
            Server parentServer;

            if (selectedNode.Tag.GetType() == typeof(Realm))
            {
                parentServer = (Server)selectedNode.Parent.Tag;
                selectedNode = selectedNode.Parent;
            }
            else
            {
                parentServer = (Server)selectedNode.Tag;
            }

            if (treeServers.SelectedNode.Tag.GetType() == typeof(Realm))
                UpdateRealm((Realm)treeServers.SelectedNode.Tag);

            if (treeServers.SelectedNode.Tag.GetType() == typeof(Server))
                UpdateServer((Server)treeServers.SelectedNode.Tag);

            ClearTextBoxes(panelSQL);
            numSQLPort.Value = 3306;
            ServerManager.Status = RealmsStatus.NEW;

            TreeNode newNode = new TreeNode("Neuer Realm");
            Realm newRealm = new Realm();

            newNode.Tag = newRealm;

            parentServer.realms.Add(newRealm);
            selectedNode.Nodes.Add(newNode);

            treeServers.SelectedNode = newNode;
            newNode.BeginEdit();
            SetEnabledControls(panelSQL, true);
        }
 private void rootCategoryToolStripMenuItem_Click(object sender, EventArgs e)
 {
     TreeNode newnode = new TreeNode();
     treeView1.Nodes.Insert(0, newnode);
     newnode.BeginEdit();
 }
示例#16
0
 private void BeginRename(TreeNode item)
 {
     projectView.SelectedNode = item;
     projectView.LabelEdit = true;
     item.BeginEdit();
 }
示例#17
0
 private void btnPlus_app_Click(object sender, EventArgs e) {
     TreeNode selectedNode = treeViewUserApps.SelectedNode;
     TreeNode tnParent = tnRoot_UserApps;
     int index = 0;
     if((selectedNode != null) && (selectedNode.Level > 0)) {
         if(selectedNode.Tag != null) {
             index = selectedNode.Index + 1;
             tnParent = selectedNode.Parent;
         }
         else {
             tnParent = selectedNode;
         }
     }
     else {
         selectedNode = tnRoot_UserApps;
     }
     TreeNode node = new TreeNode(CreateUniqueName("New Item", null, tnParent));
     node.ImageKey = node.SelectedImageKey = "noimage";
     node.Tag = new MenuItemArguments(string.Empty, string.Empty, string.Empty, 0, MenuGenre.Application);
     if(selectedNode.Tag == null) {
         selectedNode.Nodes.Add(node);
     }
     else {
         tnParent.Nodes.Insert(index, node);
     }
     treeViewUserApps.SelectedNode = node;
     node.BeginEdit();
 }
示例#18
0
		/// <summary>
		/// The user adds a new category to the custom items
		/// </summary>
		private void cmCustomCat_Click(object sender, System.EventArgs e)
		{
			TreeNode n = new TreeNode( "New Category" );
			// Issue 10 - Update the code to Net Framework 3.5 - http://code.google.com/p/pandorasbox3/issues/detail?id=10 - Smjert
			n.Tag = new List<object>();
			// Issue 10 - End

			tCat.Nodes[ 0 ].Nodes.Add( n );

			tCat.SelectedNode = n;

			n.BeginEdit();
		}
示例#19
0
		private void miCatCreate_Click(object sender, System.EventArgs e)
		{
			string path = tCat.SelectedNode.Tag as string;
			path = Path.Combine( path, "NewFolder" );

			try
			{
				Directory.CreateDirectory( path );
				TreeNode node = new TreeNode( GetDirName( path ) );
				node.Tag = path;
				tCat.SelectedNode.Nodes.Add( node );
				tCat.SelectedNode.Expand();

				node.BeginEdit();
			}
			catch {}
		}
示例#20
0
		/// <summary>
		/// Add a new subsection
		/// </summary>
		private void cmAddSub_Click(object sender, System.EventArgs e)
		{
			TreeNode node = new TreeNode( "NewSubsection" );
			// Issue 10 - Update the code to Net Framework 3.5 - http://code.google.com/p/pandorasbox3/issues/detail?id=10 - Smjert
			node.Tag = new List<object>();
			// Issue 10 - End

			tCat.SelectedNode.Nodes.Add( node );

			tCat.LabelEdit = true;

			node.BeginEdit();
		}
示例#21
0
文件: Form1.cs 项目: StevenGann/TRPG
 private void treeView1_MouseDown(object sender, MouseEventArgs e)
 {
     mySelectedNode = treeViewItems.GetNodeAt(e.X, e.Y);
     if (mySelectedNode != null)
     {
         treeViewItems.SelectedNode = mySelectedNode;
         treeViewItems.LabelEdit = true;
         if (!mySelectedNode.IsEditing)
         {
             mySelectedNode.BeginEdit();
         }
     }
 }
示例#22
0
        private void newFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (treeView1.SelectedNode != null)
            {
                TreeNode tempNode = new TreeNode("New File");

                DataRow newRow = dataSet1.Tables["files"].NewRow();

                newRow["filename"] = "New File";
                newRow["contents"] = DBNull.Value;

                dataSet1.Tables["files"].Rows.Add(newRow);
                dataSet1.AcceptChanges();

                tempNode.Tag = newRow["file_id"];
                tempNode.ImageIndex = 1;
                tempNode.SelectedImageIndex = 1;
                treeView1.LabelEdit = true;
                if(treeView1.SelectedNode.Tag.ToString() == "folder")
                    treeView1.SelectedNode.Nodes.Add(tempNode);
                tempNode.EnsureVisible();
                tempNode.BeginEdit();
            //                tempNode.EndEdit(true);
            //                treeView1.LabelEdit = false;
            }
        }
        private void subcategoryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (treeView1.SelectedNode == null)
                rootCategoryToolStripMenuItem.PerformClick();
            TreeNode newnode;

            newnode = treeView1.SelectedNode;
            while (newnode.Parent != null)
                newnode = newnode.Parent;

            if (newnode.NextNode == null && newnode.Text == UnknownId)
                return;

            newnode = new TreeNode();
            treeView1.SelectedNode.Nodes.Insert(0, newnode);
            newnode.EnsureVisible();
            newnode.BeginEdit();
        }
示例#24
0
 private void btnAddSpcFol_Grp_Click(object sender, EventArgs e) {
     TreeNode selectedNode = treeViewGroup.SelectedNode;
     if(selectedNode != null) {
         string selectedItem = (string)cmbSpclFol_Grp.SelectedItem;
         int selectedIndex = cmbSpclFol_Grp.SelectedIndex;
         string specialFolderCLSID = ShellMethods.GetSpecialFolderCLSID(arrSpecialFolderCSIDLs[selectedIndex], false);
         if((selectedIndex == 3) && !QTUtility.IsXP) {
             specialFolderCLSID = "::{26EE0668-A00A-44D7-9371-BEB064C98683}";
         }
         TreeNode node = new TreeNode(selectedItem);
         node.Name = specialFolderCLSID;
         node.ToolTipText = selectedItem;
         node.ImageKey = node.SelectedImageKey = QTUtility.GetImageKey(specialFolderCLSID, null);
         if(selectedNode.Level == 0) {
             selectedItem = CreateUniqueName(selectedItem, null, selectedNode);
             TreeNode node3 = new TreeNode(selectedItem);
             node3.ImageKey = node3.SelectedImageKey = node.ImageKey;
             node3.Nodes.Add(node);
             node3.Tag = new MenuItemArguments(selectedItem, null, null, 0, MenuGenre.Group);
             tnGroupsRoot.Nodes.Add(node3);
             treeViewGroup.SelectedNode = node3;
             node.Expand();
             node.BeginEdit();
         }
         else {
             TreeNode node4 = (selectedNode.Level == 1) ? selectedNode : selectedNode.Parent;
             node4.Nodes.Add(node);
             node4.Expand();
             if(node.Index == 0) {
                 node4.ImageKey = node4.SelectedImageKey = node.ImageKey;
             }
         }
     }
 }
示例#25
0
 private void btnAddVirtualFolder_app_Click(object sender, EventArgs e) {
     TreeNode selectedNode = treeViewUserApps.SelectedNode;
     TreeNode tnParent = tnRoot_UserApps;
     int count = tnRoot_UserApps.Nodes.Count;
     if((selectedNode != null) && (selectedNode.Level > 0)) {
         if(selectedNode.Tag != null) {
             count = selectedNode.Index + 1;
             tnParent = selectedNode.Parent;
         }
         else {
             count = selectedNode.Nodes.Count;
             tnParent = selectedNode;
         }
     }
     TreeNode node = new TreeNode(CreateUniqueName("New Folder", null, tnParent));
     node.ImageKey = node.SelectedImageKey = "folder";
     node.Tag = null;
     tnParent.Nodes.Insert(count, node);
     treeViewUserApps.SelectedNode = node;
     node.BeginEdit();
 }
        private void addDirectoryButton_Click(object sender, EventArgs e)
        {
            var node = new TreeNode("Name", 1, 1);
            if (serverDataTreeView.SelectedNode != null)
            {
                serverDataTreeView.SelectedNode.Nodes.Add(node);
                serverDataTreeView.SelectedNode.Expand();
            }
            else
                serverDataTreeView.Nodes[0].Nodes.Add(node);

            serverDataTreeView.LabelEdit = true;
            node.BeginEdit();
        }
示例#27
0
 private void btnPlus_Click(object sender, EventArgs e) {
     TreeNode selectedNode = treeViewGroup.SelectedNode;
     if(selectedNode != null) {
         if((selectedNode.Level == 0) || (selectedNode.Tag == MIA_GROUPSEP)) {
             int index = (selectedNode.Level == 0) ? tnGroupsRoot.Nodes.Count : (selectedNode.Index + 1);
             string text = CreateUniqueName("NewGroup", null, tnGroupsRoot);
             TreeNode node = new TreeNode(text);
             node.Tag = new MenuItemArguments(text, null, null, 0, MenuGenre.Group);
             tnGroupsRoot.Nodes.Insert(index, node);
             treeViewGroup.SelectedNode = node;
             node.BeginEdit();
         }
         else {
             using(FolderBrowserDialog dialog = new FolderBrowserDialog()) {
                 if(dialog.ShowDialog() == DialogResult.OK) {
                     TreeNode parent;
                     string selectedPath = dialog.SelectedPath;
                     string str3 = QTUtility2.MakePathDisplayText(selectedPath, true);
                     TreeNode node3 = new TreeNode(str3);
                     node3.Name = selectedPath;
                     node3.ToolTipText = str3;
                     node3.ImageKey = node3.SelectedImageKey = QTUtility.GetImageKey(selectedPath, null);
                     if(selectedNode.Level == 1) {
                         parent = selectedNode;
                     }
                     else {
                         parent = selectedNode.Parent;
                     }
                     parent.Nodes.Add(node3);
                     parent.Expand();
                     if(node3.Index == 0) {
                         parent.ImageKey = parent.SelectedImageKey = node3.ImageKey;
                     }
                 }
             }
         }
     }
 }
        private void btnNewServer_Click(object sender, EventArgs e)
        {
            TreeNode newNode = new TreeNode("Neuer Server");
            Server newServer = new Server();
            newNode.Tag = newServer;

            ServerManager.servers.Add(newServer);
            treeServers.Nodes.Add(newNode);

            treeServers.SelectedNode = newNode;
            newNode.BeginEdit();
        }
示例#29
0
        private void NewElement_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = ProjectTree.SelectedNode;
            var currentElement = (Element) selectedNode.Tag;

            var item = (ToolStripMenuItem) sender;
            var childType = (Type) item.Tag;
            var newElement = (Element) Activator.CreateInstance(childType);
            currentElement.AddChild(newElement);
            if (newElement is NamedElement)
            {
                ((NamedElement) newElement).Name = string.Format("New {0}", childType.GetElementName());
            }
            var newNode = new TreeNode(newElement.GetDisplayName()) {Tag = newElement};


            selectedNode.Nodes.Add(newNode);
            selectedNode.Expand();
            ProjectTree.SelectedNode = newNode;
            ApplyImage(newNode);
            ApplyErrors(newNode);


            if (newElement is NamedElement)
            {
                newNode.BeginEdit();
            }
        }
        private void ctxNew_Click(object sender, System.EventArgs e)
        {
            TreeNode node = treeView1.SelectedNode;
            if (node == null) return;

            node.Expand();

            //Insert new category
            AIONode nodeToAttach = (AIONode)node.Tag;
            tree.FoldersCount++;
            AIONode nodeToInsert = new AIONode(new AIOInfo(tree.GenerateFolderID(), "New Category", false));
            tree.InsertCategory(nodeToInsert, nodeToAttach);

            //Tree
            TreeNode newNode = new TreeNode();
            tree.CopyNodeInfo(newNode, nodeToInsert);

            //Save Container
            nodeToInsert.container = newNode;

            //Insert();
            node.Nodes.Insert(0, newNode);
            if (node.IsExpanded == false)
                node.Expand();

            newNode.BeginEdit();
        }
        /// <summary>
        /// Handles when the new group button is clicked
        /// </summary>
        private void createGroupButton_Click(object sender, EventArgs e)
        {
            // if no tree node is selected we do not know where to create the new folder
            if(treeView.SelectedNode ==null)
                return;

            // we can only create folders for behaviours and folders
            NodeTag nodetag= (NodeTag) treeView.SelectedNode.Tag;
            if(nodetag.Type !=NodeTagType.Behavior && nodetag.Type !=NodeTagType.BehaviorFolder)
                return;

            try
            {
                // if the selected tree node is a behaviour we use its folder
                TreeNode folder= nodetag.Type ==NodeTagType.BehaviorFolder ? treeView.SelectedNode : treeView.SelectedNode.Parent;
                nodetag= (NodeTag) folder.Tag;

                // create a unique node name the the name of the folder
                string label= GetUniqueLabel("New Folder", _lastNewGroup, out _lastNewGroup);
                string dir= nodetag.Filename +'\\'+ label;

                // create the new folder
                Directory.CreateDirectory(dir);

                // create the tree node for the folder
                TreeNode newnode= new TreeNode(label, (int) NodeIcon.FolderClosed, (int) NodeIcon.FolderClosed);
                newnode.Tag= new NodeTag(NodeTagType.BehaviorFolder, null, dir);

                // add the folder and expand its parent
                folder.Nodes.Add(newnode);
                folder.Expand();

                // selected the new node
                treeView.SelectedNode= newnode;

                // allow the user to define a custom name
                newnode.BeginEdit();
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message, "File Error", MessageBoxButtons.OK);

                // if there was an error we have to rebuild the list of available behaviours and folders
                RebuildBehaviorList();
            }
        }
示例#32
0
        private void addVirtualFolderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (filesDataTreeView.SelectedNode == null)
                return;

            var folderNode = new TreeNode("Folder name", 0, 0);
            filesDataTreeView.SelectedNode.Nodes.Add(folderNode);
            if (!filesDataTreeView.SelectedNode.IsExpanded)
                filesDataTreeView.SelectedNode.Toggle();

            folderNode.BeginEdit();
        }