[comp.databases] FoxPro Memo field Question

al156125@mtecv2.mty.itesm.mx (Francisco J. Peon) (04/30/91)

hi:

 I am working with Foxpro and I have a few troubles wit memo fields.

 I need to display a predefined message inside a memo field.
The message could be several lines long, so I can't print the
message in a memo window title.

     ______________________________________________
     |                                            |
     |  Author:                                   |
     |  Title :                                   |
     |  Source:                                   |
     |                                            |
     ----------------------------------------------
                    memo field

 Where Author, Title and Source are the messages that I
Would like to display each time the user edits, that memo field.


   Also I would like to know if it's possible to use the
  @ instruction (@1,1 Say "message") inside a memo.

    How can I delete a specific memo from a record?
I do not want to delete all the record neither all memo fields.

                   Any help would be really appreciated.
                   Thank's in advanced
 
                   Francisco J. Peon
                   al156125@mtecv2.mty.itesm.mx


  

pew@cs.brown.edu (Peter E. Wagner) (04/30/91)

In article <3263@mtecv2.mty.itesm.mx>, al156125@mtecv2.mty.itesm.mx (Francisco J. Peon) writes:
|> hi:
|> 
|>  I am working with Foxpro and I have a few troubles wit memo fields.
|> 
|>  I need to display a predefined message inside a memo field.
|> The message could be several lines long, so I can't print the
|> message in a memo window title.
|> 
|>      ______________________________________________
|>      |                                            |
|>      |  Author:                                   |
|>      |  Title :                                   |
|>      |  Source:                                   |
|>      |                                            |
|>      ----------------------------------------------
|>                     memo field
|> 
|>  Where Author, Title and Source are the messages that I
|> Would like to display each time the user edits, that memo field.
|> 

Do you want the user to fill in these fields first, and then have this
data copied into the memo field?

What you probably want here is simply the replace command.  Set a
variable equal to

  "Author:                                   
   Title :                                   
   Source:"

You will need to use some special characters (<Return> = chr(13)
anyway) to get the fields aligned on different lines.

    var = "Author:" + chr(13) + "Title:" + chr(13) + "Source:"

Then just replace the memo field with this string.

    replace <memo field> with var

I think this is right, but it's just coming off the top of my head.
This may not work verbatim, I'm a little rusty.

You can also use "copy to <memo>" and "copy from <memo>" (I think it's
'copy'...) to move data into and out of memo fields.  However, I
believe this is for copying in files and copying out to files...

In addition, there are some functions that allow you to manipulate the
contents of a memo field, replacing instances of strings and such.


|> 
|>    Also I would like to know if it's possible to use the
|>   @ instruction (@1,1 Say "message") inside a memo.

No, it is not.  However, you might be able to define a new window and
position it over your memo window.  You could write into this window.
You could define this window w/o a border so that it looks like you
are writing into the memo window.

|> 
|>     How can I delete a specific memo from a record?
|> I do not want to delete all the record neither all memo fields.

I think 'replace <memo field> with ""' will do the job.

Good luck!

    Peter

-- 
----------------------------------------------------------------
Peter E. Wagner          (401)863-7685        pew@cs.brown.edu
Department Computer Science   Box 1910        pew@BROWNCS.BITNET
Brown University, Providence, RI 02912        uunet!brunix!pew

Woody Allen when asked if he thought sex was dirty;
                                           `If you do it right.'
----------------------------------------------------------------

francis@wolfman.cis.ohio-state.edu (RD Francis) (04/30/91)

While REPLACE <memo filed> WITH "" might work, I know I had some
difficulty with that in FoxBASE+.  There, I wound up having a file
which contained one field, a memo field, and one record, which was
empty.  When necessary, I replaced the memo fields in my current file
with the contents of my empty memo field.

Hopefully, that's one of the things that's been improved in FoxPro.
--
R David Francis   francis@cis.ohio-state.edu