473,624 Members | 2,469 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TreeView node and multiple inheritance challenge

I am just beginning to design a Treeview display (winforms) for wine
regions. Problem. Some wine growing regions belong to two counties. Eg.
Carneros is in both Napa and Sonoma Counties. Although most nodes will have
only one parent, a few will have two parents. The Treeview which seems to me
to lend itself to the Windows Explorer type of app could not possibly show
one file as a leaf belonging to two different parent folders. You either
have a file in this folder or that one. Before I begin my exercise, I wanted
to think about how I could represent a node to have a visual indication that
a particular node has lines drawn to attach it back to two different parent
nodes? Really this is an example of multiple inheritance in a very practical
sense. Thank you for any ideas. -hazz
Nov 16 '05 #1
3 2559
Hazz,

First, your case isn't a case of multiple inheritance. It isn't a case of
inheritance at all. Inheritance defines "IS A" relationship. IS wine growing
region A county? No.

As for TreeView, I would probably append "see also" to a node label, i.e.:

Napa
...
Carneros (See also Sonoma County)
...
Sonoma
....
Carneros (See also Napa County)

HTH,
Alexander

"Hazz" <ha**@nospamero osonic.net> wrote in message
news:uG******** ******@TK2MSFTN GP10.phx.gbl...
I am just beginning to design a Treeview display (winforms) for wine
regions. Problem. Some wine growing regions belong to two counties. Eg.
Carneros is in both Napa and Sonoma Counties. Although most nodes will have
only one parent, a few will have two parents. The Treeview which seems to
me to lend itself to the Windows Explorer type of app could not possibly
show one file as a leaf belonging to two different parent folders. You
either have a file in this folder or that one. Before I begin my exercise,
I wanted to think about how I could represent a node to have a visual
indication that a particular node has lines drawn to attach it back to two
different parent nodes? Really this is an example of multiple inheritance
in a very practical sense. Thank you for any ideas. -hazz

Nov 16 '05 #2
Alexander,
Thank you for your very practical suggestion to simply qualify the dual
parent nodes by a node label clarification.
Thank you also for the "IS A" point you mentioned. I am thinking through
this. Could a wine growing region be a location as a county is?
Is a wine growing a geographical location, as a county is, which itself has
an "IS A" relationship with a state or province which are themselves
geographical locations? Like an employee has an "IS A" relationship with a
person (class?)
Thank you for helping me clarify this. I see your point absolutely and I am
not certain I am looking at these relationships correctly yet.
I should have stated that one node has two parents and not taken that leap
so quickly to the OO analogy. thx -hazz

"Alexander Shirshov" <al*******@omni talented.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Hazz,

First, your case isn't a case of multiple inheritance. It isn't a case of
inheritance at all. Inheritance defines "IS A" relationship. IS wine
growing region A county? No.

As for TreeView, I would probably append "see also" to a node label, i.e.:

Napa
...
Carneros (See also Sonoma County)
...
Sonoma
....
Carneros (See also Napa County)

HTH,
Alexander

"Hazz" <ha**@nospamero osonic.net> wrote in message
news:uG******** ******@TK2MSFTN GP10.phx.gbl...
I am just beginning to design a Treeview display (winforms) for wine
regions. Problem. Some wine growing regions belong to two counties. Eg.
Carneros is in both Napa and Sonoma Counties. Although most nodes will
have only one parent, a few will have two parents. The Treeview which
seems to me to lend itself to the Windows Explorer type of app could not
possibly show one file as a leaf belonging to two different parent
folders. You either have a file in this folder or that one. Before I begin
my exercise, I wanted to think about how I could represent a node to have
a visual indication that a particular node has lines drawn to attach it
back to two different parent nodes? Really this is an example of multiple
inheritance in a very practical sense. Thank you for any ideas. -hazz


Nov 16 '05 #3
Hazz,

Certainly, a county and a wine growing region have similarities. They both
have name and topological borders:

class Region {
string Name;
Point[] Borders;
}

class County : Region {...}

class WineGrowingRegi on: Region {...}

But here the multiple inheritance strikes: IS a county also A political
system entity?

class PoliticalSystem Entity {
string Name;
Point[] Borders;
void ElectGovernor() ;
decimal CollectTaxes();
}

You can't do that:

class County : Region, PoliticalSystem Entity {
< confusion!!! >
}

I would say that the hardest problem of OO Design is to determine which
branch of inheritance is more important semantically, and your example
demonstates it very clearly.

How would I do it in your case? It's hard to say... I think I would let Wine
Growing Regions be a separate entity... Political systems come and go, wine
culture stays.
Alexander

"Hazz" <ha**@nospamero osonic.net> wrote in message
news:O8******** ******@TK2MSFTN GP12.phx.gbl...
Alexander,
Thank you for your very practical suggestion to simply qualify the dual
parent nodes by a node label clarification.
Thank you also for the "IS A" point you mentioned. I am thinking through
this. Could a wine growing region be a location as a county is?
Is a wine growing a geographical location, as a county is, which itself
has an "IS A" relationship with a state or province which are themselves
geographical locations? Like an employee has an "IS A" relationship with a
person (class?)
Thank you for helping me clarify this. I see your point absolutely and I
am not certain I am looking at these relationships correctly yet.
I should have stated that one node has two parents and not taken that leap
so quickly to the OO analogy. thx -hazz

"Alexander Shirshov" <al*******@omni talented.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Hazz,

First, your case isn't a case of multiple inheritance. It isn't a case of
inheritance at all. Inheritance defines "IS A" relationship. IS wine
growing region A county? No.

As for TreeView, I would probably append "see also" to a node label,
i.e.:

Napa
...
Carneros (See also Sonoma County)
...
Sonoma
....
Carneros (See also Napa County)

HTH,
Alexander

"Hazz" <ha**@nospamero osonic.net> wrote in message
news:uG******** ******@TK2MSFTN GP10.phx.gbl...
I am just beginning to design a Treeview display (winforms) for wine
regions. Problem. Some wine growing regions belong to two counties. Eg.
Carneros is in both Napa and Sonoma Counties. Although most nodes will
have only one parent, a few will have two parents. The Treeview which
seems to me to lend itself to the Windows Explorer type of app could not
possibly show one file as a leaf belonging to two different parent
folders. You either have a file in this folder or that one. Before I
begin my exercise, I wanted to think about how I could represent a node
to have a visual indication that a particular node has lines drawn to
attach it back to two different parent nodes? Really this is an example
of multiple inheritance in a very practical sense. Thank you for any
ideas. -hazz



Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1529
by: Ravi | last post by:
i tried with MS treeview control but i am unable to implement all the requirements.This requiement like when user login will generate the menu and display it. After that we need to Add or remove the nodes from the tree from client side. 1.Selected node should be highlighted and non active. 2.some group of pages related to same category EX : registration process Aggrement,userinformation,login information and
0
1247
by: Query | last post by:
Hi, I'm going through the MS Press Stepladder book on C++ and .net, using their file dialog treeview example I find that plus / minus signs are indiscriminatly added to all nodes when set_ShowPlusMinus is true. I'm assuming that this is a pretty elementary problem, but has frustrated me to no end. This is what I have private: System::Void treeView1_BeforeExpand(System::Object * sender, System::Windows::Forms::TreeViewCancelEventArgs
6
2963
by: Yavuz Bogazci | last post by:
Hello, the following code selects recursively the Outlook folders and shows these in a Treeview. Everything works nice. I have the following problem: I would like have a TreeNode a text and two more values assigned to this TreeNode e.g. an UserID and a Text. These two information should not be visible. But if a user selects the TreeNode i would like to read the information of the selected TreeNode.
2
2672
by: kevin | last post by:
I would like to remember the state of the nodes after the treeview gets disposed, but not necessarily after the app terminates so I don't need a disk file. I was thinking about using the tag property, but I am already using it, so then I though about making a custom treeiew using inheritance and adding another tag type property? Any clues? kevin
4
9396
by: Andrew Robinson | last post by:
I am using a TreeView to perform navigation and have a few nodes that need to generate a popup menu. For this, I use the SelectedNodeChanged event and then add the relevant "window.open" script to the page using the ClientScript.RegisterStartupScript method. This seems to work fine, but if the user clicks on the same node twice, the event doesn't fire a second time. I assume this is by design as the Node Selection hasn't changed, but...
1
21615
by: watsod1 | last post by:
Hello, This is my first post, Hello to all. This also a test post to make sure that I am doing the right thing and following rules etc. I have been searching for a way to make the treeview display multiple lines of text on each treeview node (treenode). After searching for answers and not finding any, I stumbled on the solution in the msdn help files (search for TreeView.DrawNode Event). It has source code that shows how to display...
18
15359
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.
5
7512
by: Max2006 | last post by:
Hi, I have a TreeView and this is my node style: <asp:TreeNodeStyle ForeColor = "#000000" Font-Size="9px" Font-Bold="false" Width="100px" NodeSpacing="3px" /> The problem is the expand button (+) resides right at the middle of multi-line text. Can I make the expand button top align instead of middle align?
3
4700
by: dutsnekcirf | last post by:
I have a treeview control on a custom task pane in Excel. I've enable the ability to use Drag & Drop (by following this how-to) on the treeview to change the order of the nodes. The problem though is if I close the application and then go back in, the nodes are back in the order they were before I had reordered them. Is there a way that I can modify my DragDrop event to permanently change the index of the nodes? Here's my code if you're...
0
8240
marktang
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...
0
8680
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8336
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,...
0
7168
agi2029
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...
1
6111
isladogs
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...
0
5565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2610
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1487
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.