Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / January 2005

Tip: Looking for answers? Try searching our database.

TreeView Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Beringer - 06 Jan 2005 09:18 GMT
I am deriving my own TreeView control from the 1.0 Framework TreeView.
I have overriden the OnAfterSelect method and want to respond to selection
of a node.
The issue I am having is that if the user selects a node and then clicks the
node again, no OnAfterSelect event is triggered.  I figure this is the way
it is supposed to work but would like to work around this.
Has anybody had this issue and found a way to work around it?
I thought I could monitor OnMouseUp events and see if the left mouse button
is clicked on the selected node and then call OnAfterSelect from with in
OnMouseUp.
This creates a new issue of when you actually do select another node, now
OnAfterSelect gets called twice (once for the select and once for the mouse
up event).  Oh and in case your wondering, I'm pretty sure the OnAfterSelect
event is fired before the OnMouseUp event.  A snipet of my code is shown
below:
protected override void OnAfterSelect(TreeViewEventArgs tvea)

{

   base.OnAfterSelect(tvea);

   ...

   do really cool stuff when node is selected!

   ...

}

protected override void OnMouseUp(MouseEventArgs mea)

{

   base.OnMouseUp(mea);

   if (mea.Button == MouseButtons.Left)

   {

       TreeNode node = GetNodeAt(mea.X, mea.Y);

       if (node == this.SelectedNode)

       {

           OnAfterSelect(new TreeViewEventArgs(this.SelectedNode));

       }

   }

}
Nick Stansbury - 06 Jan 2005 15:25 GMT
Hi,
      Telerik have put a lot of work into a custom treeview - have a look
at www.telerik.com/radtreeview

> I am deriving my own TreeView control from the 1.0 Framework TreeView.
> I have overriden the OnAfterSelect method and want to respond to selection
[quoted text clipped - 48 lines]
>
> }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.