[Gambas-user] How to organize dependent lists

tobi tobiasboege01 at ...1601...
Tue Feb 28 18:33:26 CET 2012


hi,

On Tue, 28 Feb 2012, Rolf-Werner Eilert wrote:

> Hi folks,
> 
> I would be interested in your opinions. In a project I've got two lists 
> of data and further data which are mutually dependent, such as
> 
> item 1:
>     item 1 a
>        data 1 aa
>        data 1 ab
>     item 1 b
>        data 1 ba
>        data 1 bb
> 
> and so on, which could be seen like a tree or directory structure.
> 
> Now my question is, how would YOU organize this internally? I mean, what 
> kind of data structure would you prefer to be able to easily find your 
> way through it? In the GUI, it looks like two ListBoxes and two TextBoxes:
> 
> List1   List2     TextBox1
>                    TextBox2
> 
> If you choose item1 in List1, List2 will show item1a and item1b. When 
> you choose item1a, the Textboxes show data1aa and data1ab. If you choose 
> item1b, the Textboxes show data1ba and data1bb.
> 
> Of course, I could make a matrix of
> 
> item1  item1a  data1aa
> item1  item1a  data1ab
> item1  item1b  data1ba
> item1  item1b  data1bb
> 
> but how would my program EASILY find which data to show if the user 
> clicks item1a for instance? Another idea was to leave out repetitions:
> 
> item1  item1a  data1aa
>                 data1ab
>         item1b  data1ba
>                 data1bb
> 
> This shows the tree-like structure better, but is it a professional 
> approach?
> 
> Thanks for your ideas.
> 
> Rolf
> 
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user

well, my approach would be using a class that has an array of instances of the same class (reminds
me of linked lists). i don't know if it is possible in gambas, haven't tried or read about it but it
may look like:

---
CNode.class:

Public Children As CNode[]
---

or, which may be more intuitive in later usage:

---
CNode.class:

Inherits Array

Public Children As CNode[]

Public Function _get(iInd As Integer) As CNode
  Return Me.Children[iInd]
End
---

in fact, i haven't programmed in Gambas for about a month and have no possibility to check my
suggestions but i think you see the point.

regards,
tobi




More information about the User mailing list