column view of hierarchical text

Björnke von Gierke bvg at mac.com
Tue Aug 14 12:37:28 EDT 2007


I have done it, but I can't share the stack, it's too embarrassing. 
It's a very old one, and partly was developed in 1.1.1 tester version, 
so has code split all over the place, to adhere to the 10 line limit.

What it did was basically send the next field in the row the line 
clicked, and that field then would decide which content to show based 
on that. If you arrange list fields, and name them in a successive way 
(eg: "column 1", "column 2",...) then you can just add one to the 
current field, and know which the next should be (send "ShowLines" && 
the selectedtext of me to field ("column" && word 2 of the short name 
of me+1")).
Then to hide all fields that are not needed, you'd do the same, but 
invoking a handler that hides that particular field, and every one 
above (untested):

on hideCols --in every fields script
   hide me
   if there is a field ("column" && word 2 of the short name of me+1) 
then
     send "hideCols" to field ("column" && word 2 of the short name of 
me+1)
   end if
end hideCols

As an added exercise I did not do (I just arranged 10 fields and was 
glad it worked (also there was a bug with clone setting the cursor back 
then)), you could check every time if the next field exists, and if 
not, clone the field currently the last one, setting the location 
correctly, and changing the name to ("column" && word 2 of the short 
name of me+1).

Watch out if you put the fields into a horizontally scrollable group, 
if the group is scrolled, the fields locations change, so use relative 
positioning, not absolute. You can also scroll the group to show 
exactly the last visible field, if a user chooses a line, and be better 
then the OS X finder (which is horribly wrong often (if it scrolls at 
all)).

As for "editing in the same way", do you mean the way the finder does 
file renaming? If yes, just make one editable field, and if a line is 
double clicked, put that field over the line, covering it completely. 
If the user hits return or clicks outside the field, put the contents 
of the field into the correct line of your column field. It'd look and 
behave quite similar.

Have fun
Bjoernke


On 11 Aug 2007, at 18:16, Douglas Ivers wrote:

> I want to display a hierarchy (think: outline) in the way that the Mac 
> Finder does with column view.  Note that I am NOT interested in 
> displaying files and folders, rather outline text.  I also want to be 
> able to edit the text in the same view.
> ...
> Has anyone done this already in a Rev stack?
> ...


-- 

official ChatRev page:
http://chatrev.bjoernke.com

Chat with other RunRev developers:
go stack URL "http://homepage.mac.com/bvg/chatrev1.3.rev"




More information about the use-livecode mailing list