Treeviews

From: James J. Gavan (jgavandeletethis_at_shaw.ca)
Date: 02/22/05


Date: Tue, 22 Feb 2005 18:59:15 GMT

Really just to advise Kellie and Michael. I've solved it, (how to
indicate what has been actioned or not actioned). Like all things GUI
not difficult once you can see a coded solution - it's finding the
solution, (from the plethora of methods), which can sometimes be
frustrating.

As images I create an Array (collection) containing two icons, Greenball
and RedBall, identified respectively as 1 and 2. First showing of the
Treeview you want all to appear as 'Unactioned' = Redball. After intimal
display any Adds, Changes or Deletes affect the display. For Add and
Change, select Greenball. Delete - well the label disappears from your
Treeview and the record is deleted from File/DB

As you create/revise the displayable Label you select the icon value 1
or 2 which gets 'attached' to your label. (Interesting point - setting
the size for your icons to 16 x 16, when creating the icon Array above,
  controls how the rest of the Treeview displays; use 48 x 48 and the
whole Treeview picture EXPANDS, automatically throwing in an Horizontal
Scrollbar which you will need to use to see the 'clipped' or right side
of the Treeview).

You might recall I was experimenting with Buttons/NoButtons,
LinesAtRoot/NoLinesAtRoot, Lines/NoLines. I 'discovered' if I code
'noButtons' and use icons - then you can click on icons to expand or
contract the Treeview. The only time it appears to come 'unstuck' is if
the user contracts the Treeview to show just the Root Level. (When I do
my initial display I expand the Root to show the list of Level 1's).

The only outstanding feature I have to resolve, not GUIs but program
logic, is how to indicate the Level above should appear as a GreenBall
when all its 'children' have Greenballs.

(1) - invoke ThisLevelObject "getAncestor" returning ParentLevelObject

(2) - invoke ParentLevelObject "getID" returning IconID - if it shows
already Greenball - no further action; otherwise :-

(3) - invoke ParentLevelObject "children" returning
ParentLevelOrderedCollection

(4) - do a callback/iterator against the ParentLevelOrderedCollection
testing each element (Child Label), for its IconID - if they all show
Greenball then the Parent Level label can be changed to show a Greenball

(5) - depending upon how many Levels you have, will need to work upwards
through the hierarchy to see if any other ParentLevels have to be
changed to Greenball. (e.g. this Level 2 has now be changed to a
Greenball and Level 1 has a RedBall - check the Level 1 to see if it
should be changed to a Greenball - this is a repeat of Steps 1 through 4
above).

(6) Deletes - well they are 'destroyed' - but they *might* affect the
outcome. Assume five Level 3 labels - four are Greenballs and the fifth,
which you are deleting, is a Redball. Got to use the routines above to
see if the Level 2 can now be changed to a Greenball.

Not at all difficult using the methods provided - just have to get my
logic correct.

Jimmy, Calgary AB