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

sm196103@seas.gwu.edu (Scott Cherkofsky) (03/04/91)

Hiya,

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.  Upon resorting the name list, that empty line
(which I thought ws transparent to HC 2.0) then gets shuffled to the top
when I sort ascending.  Hpow do I get rid of this empty line? Any suggestions?

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?

Thanx a bunch!

Scott

Please relpy to sm196103@seas.gwu.edu


-- 
Scott Cherkofsky			"The experience of going through
sm196103@seas.GWU.edu			 life may be intended as a warning
Mechanical Engineering student		 not to do it again."
Executive Office of the President		-- Ashleigh Brilliant

Ken.Knight@f421.n109.z1.fidonet.org (Ken Knight) (03/05/91)

Scott, instead of putting empty into the line that has the name you
want to delete simply use the delete command
 delete line x of field "foo"
 
I assume you are using the find command to find the name to remove. If
so, then you can use the value returned by the FoundLine() function.
Specifically:
 find x in field "foo"
 if the result is not "not found" then
   get the foundline
   delete line (word 2 of it) of field "foo"
  end if
  ....
 
As to scrolling fields check out the Power Tools stack and see how it
is done there.  That shows one way to do it effectively.
 
Hope that helps...
 
  ** Ken **


--  

        Ken Knight, Ken.Knight@f421.n109.z1.fidonet.org
      via The Black Cat's Shack's FidoNet<->Usenet Gateway
          blkcat.fidonet.org   and   Fidonet 1:109/401

gdavis@primate.wisc.edu (Gary Davis) (03/06/91)

From article <3802.27D37A60@blkcat.fidonet.org>, by Ken.Knight@f421.n109.z1.fidonet.org (Ken Knight):
> I assume you are using the find command to find the name to remove. If
> so, then you can use the value returned by the FoundLine() function.
> Specifically:
>  find x in field "foo"
>  if the result is not "not found" then
>    get the foundline
>    delete line (word 2 of it) of field "foo"
>   end if

Two minor suggestions:

     You can also just say
     
          delete the foundLine

     It's best to say

          if the result is not empty

     According to Dan Winkler, there's no guarantee that the failure of
find wil continue to be reported as "not found" in future versions of
HyperCard.

Gary Davis