I have a treeview with ownerdrawn nodes. I also set an invividual indent value for each node, so each node has new bounds. The problem occurs on mouseover, hottracking is not triggered when mousing over the the last portion of the node - portion that equals to the length of the indent. Is there a way to set the mouseover bounds or maybe catch the event that triggers hottracking and force hottracking when mousing over the new bounds?
xilefxilef
Posts
-
node hottracking -
MySQL data connectionthanks for all the info. I've been using DataReaders so far and just came across the adapter. So I'll stick with the reader.
-
MySQL data connectionI have a treeview that I populate with data from various tables in mysql db. I also update the tables based on user actions. I was wondering, is it more efficient to use a mysqlDataAdapter for this or just CommandText and MySql Reader for populating and then separate CommandText statements for updating?
-
delegate invocationok, solved it. The idea is to have treeview beginupdate in the begginning of the textchanged delegate invocation and endupdate at the end when all nodes are updated. public class TagObject {... public event EventHandler TextChanged; public int TextChangedCount; public bool startOfInvocation; ... public void OnTextChanged(TextChangedEventArgs e) { if (TextChanged != null) { this.TextChangedCount = TextChanged.GetInvocationList().GetLength(0); this.startOfInvocation = true; TextChanged(this, e); } } *******************************************************************8 public class MyTreeNode : TreeNode {... public void UpdateTagText(string text) { ((TagObject)this.Tag).Name = text; }... public void UpdateText(object sender, EventArgs e) { TagObject tagObj = (TagObject)this.Tag; if (tagObj.startOfInvocation) { this.TreeView.BeginUpdate(); tagObj.startOfInvocation = false; } this.Text = ((TextChangedEventArgs)e).Text; tagObj.TextChangedCount--; if (tagObj.TextChangedCount == 0) { this.TreeView.EndUpdate(); } } takes about a sec for 500 nodes.
-
delegate invocationBut why does the time it takes for node to update its text depend on the number of nodes in a tree? Because if I update node text when only 50 nodes are tagged with the same object is very fast compared to when 1000 are tagged with the same obj.
-
delegate invocation******************************************************** public class MyTreeNode: TreeNode {... public MyTreeNode(TagObject obj) { ... this.Tag = obj; obj.TextChanged += new EventHandler(UpdateText); ... } public void UpdateTagText(string text) { ((TagObject)this.Tag).Name = text; } public void UpdateText(object sender, EventArgs e) { this.Text = ((TextChangedEventArgs)e).Text; System.Diagnostics.Debug.WriteLine(((TagObject)this.Tag).c++.ToString()); }... *********************************************************************** public class TagObject { public event EventHandler TextChanged; private string name; public int c = 0; ... public string Name { get { return this.name; } set { this.SetName(value); } } // Invoke the TextChanged event when text changes public void OnTextChanged(TextChangedEventArgs e) { if (TextChanged != null) TextChanged(this, e); } private void SetName(string text) { this.name = text; TextChangedEventArgs ea = new TextChangedEventArgs(); ea.Text = text; OnTextChanged(ea); }... } public class TextChangedEventArgs : EventArgs { private string text; public string Text { get { return this.text; } set { this.text = value; } } } ***************************************************************** from the form class that contains my treeview: ... private void treeView_AfterLabelEdit(object sender, NodeLabelEditEventArgs e) { ((MyTreeNode)e.Node).UpdateTagText(e.label); } ...
-
delegate invocationI'm using AfterLabelEdit to trigger the main text change event. I also put print statements inside the custom UpdateText method of my custom TreeNode, the same UpdateText that is added as a delegate to the invocation list of the eventhandler inside the tag object. The print statements increment a counter each time text is updated. With 40 nodes to update, I get '1, 2, 3,...' and so on fairly quickly. With 1000, it take a while for each counter to print, which indicates longer time between invocation method execution. Any thoughts? thanx.
-
delegate invocationI have a treeview where multiple nodes are tagged with the same tag object. When one node's text is changed, i'm using the tag object to trigger an event to change the text for all the rest of the nodes tied to this tag object. After having close to 1000 nodes tied to the same tag object, the text update takes forever. I put some print statements inside the delegate method to see how the invocation list is being executed. Well it seems that the more delegate methods registered the slower it goes from each delegate method to the next. Why would an increase in length of the invocation list slow down transition from one delegate method to the next?
-
updating treenode text dynamicallyYes, event triggered by tagged class is probably the best solution, but keeping a node list in tagged class is also good. thanks.
-
updating treenode text dynamicallyRight, it has all nodes, but this way I need to enumerate through all of them and find the ones I want to update. I was talking about an event that would trigger an update without having to enumerate through the whole tree. I would override TreeNode.Text property to point to tagged object's text property, but strings are immutable and if I change tagged object's text property, it would do nothing to nodes text.
-
updating treenode text dynamicallyI do not have a collection of other nodes that need to be updated, so cannot enumerate. This is a form treenode, not web, so there is no updateOnDemand property. I was thinking of doing this on text update - calling tag object method that in turn calls treenode's method to update the text. this way, a single node text update would trigger text update for all nodes tagging the same object. Is there a better way?
-
updating treenode text dynamicallyI have a treeview where many treenodes belonging to different parent nodes may represent the same object, so if a user updates a text for such node, it should also trigger an update of text for all other nodes representing the same object. For instance if I have nodes representing school classes (math, english...) each class node has student nodes with student name as text, so numerous classes can contain the nodes with same student name. If I change students name under one parent, it should update it under the rest. I would assign the student object to nodes tag, but how would I trigger a text update? thanks
-
control border settingsI have a border set in all my form controls to Fixed3D but when I run the app, it displays FixedSingle for all of them. And this is across many forms in this project. I have other projects where the border settings display correctly. What could be causing this? Thank you
-
draw / rectangle / boundsWhen drawing an item and setting its bounds, is there a way to use fractions? For instance if I want to start at X=1.4 and Y=2.5 and have Width = 10.5 Height = 11.5.
-
ownerdrawn treenodesthanks. So I guess if I want those boxes with plus/minus to the left of the node for expansion and contraction, I need to draw them myself.
-
ownerdrawn treenodesHi, While drawing treenodes, I'm having difficulties drawing the the boxes with pluses and minuses for node expansion. And also, I'm unable to simulate the hottracking action for each node when mousing over. Can you please help? thank you
-
custom control propertiesok, sorry for not being more clear. No, I have a custom control. And for this control, I need to create a custom property that has checkboxes in my customs control's property grid. Similar to 'Dock' property that displays a clickable custom graphic on the dropdown. Or if you look at 'ShortCutKeys' property for 'ToolStripMenuItem' control, you'll see a drop down with checkboxes. So lets say I have a custom Button control with custom 'Text' property. And when a user sets this 'Text' property, in the property grid dropdown for this property, I need to display checkboxes with values.
-
custom control propertiesI wanted to create a custom control property that includes checkboxes, just like ShortCutKeys property for ToolStripMenuItem. How would I create something like this? thank you
-
servlet vs serverHi, I was wondering what is the difference between a Java servlet container (such as Tomcat) and a Java application server (such as WebLogic)? thank you -- modified at 1:32 Monday 27th March, 2006
-
inherited controlsHi I have an application that has many different forms. All these forms use a certain kind of a TreeView that has drag/drop rules, copy/paste rules and other functionalities. I'm trying to create one inherited TreeView control instead of doing this for every TreeView in my application. Where do I start? How do I go about accomplishing that? Thank you for your help.