I have a treeview linked to a series of panels, making the correct
panel visible depending on which node is selected.
I now want to check that the user is allowed to leave the current node
they're on before letting them do so (popping up a "You have unsaved
data - save?" box).
However, there doesn't seem to be a "BeforeLeav ing" event that fires
before focus changes from one node to another.
Am I missing something, or do I have to just code my way around it?
Cheers,
Andy D 2 4863
I assume you are speaking of the Windows Forms Treeview species.
Treeview exposes a number of events, including MouseUp and MouseDown.
If you have stored the node a user is on, you can perform your test in the
MouseDown event, checking to see if they have "Mouse Downed" onto a new node,
and do your validation check and "popup" before allowing the rest of your
event handler code to execute.
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Andrew Ducker" wrote: I have a treeview linked to a series of panels, making the correct panel visible depending on which node is selected.
I now want to check that the user is allowed to leave the current node they're on before letting them do so (popping up a "You have unsaved data - save?" box).
However, there doesn't seem to be a "BeforeLeav ing" event that fires before focus changes from one node to another.
Am I missing something, or do I have to just code my way around it?
Cheers,
Andy D
Andrew,
Thre is no BeforeLeaving event, but there is BeforeSelect event that covers
exactly your case.
Handle this event and check SelectedNode (this is the node that currently is
selected). Do the validation and if the data haven't been saved yet, set the
event argument's property Cancel to *true* this will cancel changing the
selection and will keep the previously selected node.
HTH
Stoitcho Goutsev (100) [C# MVP]
"Andrew Ducker" <an****@ducker. org.uk> wrote in message
news:11******** ************@g1 4g2000cwa.googl egroups.com... I have a treeview linked to a series of panels, making the correct panel visible depending on which node is selected.
I now want to check that the user is allowed to leave the current node they're on before letting them do so (popping up a "You have unsaved data - save?" box).
However, there doesn't seem to be a "BeforeLeav ing" event that fires before focus changes from one node to another.
Am I missing something, or do I have to just code my way around it?
Cheers,
Andy D This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Plumer |
last post by:
Hello everyone,
I am using MS .NET Framework 1.0 Version 1.0.3705 developing a C# client
application using SQL Server on the server side.
I am looking to implement drag & drop in a TreeView control. The operation
takes place entirely within this single control. There is no need to provide
for interaction with other controls, forms, applications etc. Both the drag
source item (a TreeNode) and the drag target item (another TreeNode) are...
|
by: Steve |
last post by:
Visual Studio 2003 .NET / C#
I have a treeview object on a form which acts as the main menu controller
for my application. the treeview is always in sight, and the form it is on
acts as the main container for the whole application. All other screens are
UserControls, which get added and removed from/to the main form, when the
user clicks an item on the tree view.
I thought the best way to handle navigating around would be to define...
|
by: (Pete Cresswell) |
last post by:
I've got KeyDown coding and it fires when other keys are pressed, but when Enter
is pressed, nothing.
I'd like to support the (standard?) Windows behavior of executing DblClick
processing when an item is selected and the user presses Enter
I got focus to stop moving to the next control via Tools|Options|Keyboard|Move
after enter....but now it just sits there and neither KeyDown nor KeyPress seems
to catch it.
|
by: Michael C |
last post by:
Hi all,
I half-resolved my previous TreeView issue. Now I was wondering if anyone
knows of a way to keep a TreeNode from being highlighted when it is
left-clicked? It seems like there should be an event I could intercept, or
a property I could set, but I'll be darned if I can figure out which one...
Thanks,
Michael C., MCDBA
|
by: rh |
last post by:
I created a user control that is made up of a TreeView and a VScrollBar. I
set the TreeView.FullRowSelect = True and it works as expected (full row is
visible, appears on top of everything else) but only sometimes. Other times
it appears behind the parent form and all that is visible is the last few
characters of that row.
Anyone know what might be causing this and how I can fix it? Thanks.
| |
by: Ravi |
last post by:
Hi all.
Help needed Regarding vb.net.
I have the User Interface of my application, Which has a treeview on
the left and a set of panels on the right(which have textboxes).
When Ever i Click a node on the treeview the corresponding panel
appears in the right. with the respective details.
When I add new nodes in the treeview using MenuItems in the fileMenu
on the top, a new node is created and then I get empty-fields on the
|
by: p3t3r |
last post by:
I have a treeview sourced from a SiteMap. I want to use 2 different CSS
styles for the root level nodes. The topmost root node should not have a top
border, all the other root nodes should have a top border.
Is it possible to have more than 1 style at the same level (parent node)
when using a SiteMap?
I want it to appear something like this and I can only find a way to either
have the border on all root nodes or none at all. In...
|
by: Victor Rodriguez |
last post by:
Is there a way that I can have a client side event like
oncontextmenu="showfunction();" on each node?
thanks,
Victor
|
by: =?Utf-8?B?TGkgV2VuZw==?= |
last post by:
Hi,
Is there a way for TreeView to have multiple selections? But I am not
talking about its checked boxes.
I want a way similar to ListView with MultiSelect = True. So I can use
or key and click to make multiple selections. Then when I
simply click one item, all previous selections are gone.
Thanks in advance.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |