[comp.sys.mac.hypercard] Deleting lines/scrolling fields

fvernon@cudnvr.denver.colorado.edu (Frank Vernon) (03/05/91)

In message-ID: 2819@sparko.gwu.edu, Scott Cherkofsky (sm196103@seas.gwu.edu)
writes:

>I have a field that holds a list of people to which names can be added,
>and deleted.  When changes are made, I resort the field alphabetically, but
>this does not work so well when I have deleted a name from the list.

>To delete a name, I search for the name, determine what line it is on and then
>put EMPTY into that line.

If you will [delete line x of field "Names"] this will solve the problem. When
you [put empty] into a line, it simply removes all the text from the line, and
leaves the return character as a place holder for the line. When you [delete]
a line, it actually removes the entire line including the return character.

>My second problem deals with getting two separate scrolling fields to scroll
>in tandem with each other (ie when I scroll one the other scrolls to the 
>same position).  I have been able to do this rather crudely using the Scroll
>parameter but this brings up the problem.  These fields are going to have
>data input by the user.  I have found that once the last visible line in
>the field is reached and data is input into the first field, the second fails
>to scroll (obviously this is caused by the fact that the second field has no
>data where the first is telling it to scroll).  Any ideas?

This is problem is not so easily fixed. I have spend a great deal of time 
working with this exact problem and there are a variety of solutions but only
two are very usefull.

1) Lock the text of all the fields in question and use full script control to
put the information into the fields.
For example, I commonly use a combination of pop-up menu's and single line
fields that act similar to the "entry bar" that you find in spreadheets. You
could also use "ask" and "answer" dialog boxes.

2) Write an [on idle] handler to watch the number of lines in each field and
pad them out with empty lines so that there will always be at least 1 empty
line at the bottom of the field. This gets quite complicated though since
it is quite easy to get a large number of empty lines at the bottom of the
list.

I have found the first solution to be the best. The second solution does work
in most instances, but it can be quite slow since you have to test the length of
all the fields and then pad them all out to the same length. 

I recently finished creating an commercial update to Focal Point II to make it
compatable with Hypercard 2.0, and close to 85% of all the script changes made,
had to do with the linked scrolling fields in the various stacks. Due to the
structure of Focal Point II, I was forced to use technique number 2 above, and
trust me, this is a pain to write and very slow in operation.


Frank Vernon
Nine to Five Software, Inc.
InterNet: FVERNON@cudnvr.denver.colorado.edu
BitNet:   FVERNON@CUDENVER
America Online: NineToFive
(303) 443-9713