A little help needed please ;?(

Richard Gaskin ambassador at fourthworld.com
Wed Dec 22 14:21:24 EST 2004


D.Rothe wrote:
> Hi, I am playing with a small program for storing friends contact info. I am using a data.txt file delimited by "|" for saving info to.
> The problem I have hit is HOW TO DELETE THE SELECTED CONTACT from the txt file properly?
> I am trying to delete the selected info from the txt file via another stack. I can delete the selected line no probs but thats it.
> The best way to understand is to see an example. I have attached the stack(s) and data.txt file for you to see.

For bandwidth considerations, attachments are stripped from submissions 
to this list before forwarding to list members.  There are a lot of 
people here with a wide variety of connection speeds and billing plans, 
so in general it's considered good practice to only include a URL to a 
file in a list posting, so those who have the time and interest can 
download it leaving the others free not to.

When you read the file you can replace "|" with tab in the data set, and 
then putting it into a field will give you nice columns automatically if 
you set the vGrid of the field to true.

To delete a line you could have something like this in a "Delete" button:

on mouseUp
   --
   -- Allow user to cancel:
   put the hilitedLine of fld "List" into tLine
   answer "Delete line "&tLine&"?" with "Delete" or "Cancel"
   if it is "Cancel" then exit to top
   --
   -- Delete the line:
   delete line tLine of fld "List"
   --
   -- save to disk:
   get fld "Disk"
   replace tab with "|" in it
   put it into url ("file:/folder/data.txt")
end mouseUp

--
  Richard Gaskin
  Fourth World Media Corporation
  __________________________________________________
  Rev tools and more: http://www.fourthworld.com/rev


More information about the use-livecode mailing list