master index(for no-frames browser only)
Vfp - Logging Trace Window
Vfp - Mapi Example Code
Vfp - Multi-threads And C++
Vfp - New Gendbc
Vfp - Object Class Invalid For Container
Vfp - Ocx - Mscomm32.ocx
Vfp - Ole And Word7
Vfp - Ole Outline Control
Vfp - Ole, Word6/7
Vfp - Read Only Forms
Vfp - Referential Integrity Error Routine
Vfp - Report Data Environment
Vfp - Row Buffering And Updates
Vfp - Rules And Triggers, Firing Order
Vfp - Setup Wizard Error
Vfp - Sql Views In Dbc
Vfp - System Requirements
Vfp - Textbox Class
Vfp - Update Error - Table In Use

Index

VFP - LOGGING TRACE WINDOW

Date: Mon, 19 Feb 1996 15:45:38 -0600
From: Richard Seymour <rseymour@winternet.com>
Subject: RE: Trace window to printer?

I don't know of a way to do this. Once I saw a way to use the trace window
to create a log file. It's quite a kludge, but it may help.  This is what
you do.

1.  In the command window type gnHandle = FOPEN( "LOG.TXT" )
2.  In the trace window enter FPUTS( m.gnHandle, STR( LINENO() ) + TIME() )
3.  Run your program.
4.  Afterwards type =FCLOSE( m.gnHandle ) in the command window.

Or something like that. The net effect is to create a file. (Log.Txt) and
then to output a character  expression into that file along with the time
of day. You can then look at this log file to determine how long each line
took to execute or whatever.

Hope this helps.

Richard Seymour, Anarchy Software
rseymour@winternet.com
http://www.winternet.com/~rseymour/



Index

VFP - MAPI EXAMPLE CODE

Subject:
            RE: VFP/MAPI/Win95 Show() or !Show()
       Date:
            10 May 1996 01:08:34 GMT
       From:
            Richard A Casesa <Casesa@msn.com>
Organization:
            Microsoft
 Newsgroups:
            microsoft.public.fox.programmer.exchange
 References:
            1




Here's some test code I wrote a little while ago.  It took me a while to
figure it out, but I finally got it working

thisform.MAPISession.SignOn()
thisform.MAPIMessage.SessionID = thisform.MAPISession.SessionID
wait window "Session Started" nowait

thisform.MAPIMessage.Compose()
thisform.MAPIMessage.RecipDisplayName = "John Smith"
thisform.MAPIMessage.MsgSubject   = "Test"
thisform.MAPIMessage.MsgNoteText  =  "blah, blah, blah"
thisform.MAPIMessage.Send(.f.)
wait window "Message Sent" nowait

thisform.MAPISession.SignOff()
wait window "Session Ended" nowait

On Thursday, May 09, 1996, Timothy J. Bassett wrote...
> I am trying to MAPI-enable out application.  I can get everything to
work
> fine if I .Show() the message.  But, if I try to do everything manually,
I
> get an error of "OLE IDispatch exception code 0 from MSMAPI32:
Unspecified
> failure has occurred." after the .Send().
>



Index

VFP - MULTI-THREADS AND C++

Date: Thu, 06 Jul 1995 08:06:16 -0900
From: johnl@triweb.com (Kevin Pirkl)
Subject: RE: RE: VFP Simult Events -Reply

Date: Wed, 05 Jul 1995 08:32:50 -0600
From: Craig Berntson <Craig@teltrust.com>
Subject:  RE: VFP Simult Events -Reply

In message Thu, 22 Jun 1995 08:59:31 -0900,
  johnl@triweb.com (Kevin Pirkl)  writes:

>> For all you VFP up and comming experts, how on this VFP 32 bit
>> platform can I write code that will allow two querys to run
>> simultaneously. I have this little C++ program that is able to pass via
>> DDE multiple queries before VFP has processed the first one.  I have
>> noticed that the FOXPRO DDE server portion takes a second incomming
>> request defore the first one is done processing.  But at this point the
>> second request is placed on a queue and the first one is processed before
>> the second one takes over.  This is not the behavior that I am looking
>> for.  I want be able to timeslice the app then to move over and work on
>> the other request for a bit and then back.  I have played around with the
>> new timer object but without writing a queue of my own the timer object
>> seems to fall short.

>Quite simply, VFP cannot multi-thread the internal
>commands (AFAIK).  I can't imagine why you would
>want to, in this scenario, anyway.  SInce
>executing a single SELECT takes up a buch of
>horsepower, slicing that up would cause swapping
>of a large degree, and would likely kill
>performance.
>Running the two SELECTs sequentially will,
>ultimately, prove to be faster.


Why you ask?  I have written a program that parses Web-CGI Documents in VFP.
Web Servers are muti-threaded and handle simult requests.  I have a dual
Pentium system and want use it to the fullest extent.

I have solved my problem though.  Since VFP is re-entrant I can run multiple
copies of my app with less overhead.  My CGI scripts communicate via DDE ( a
very small (( 5k )) 32 bit C++ program for the communications). I run
different copies of the VFP DDE server program each instances each with it's
own DDE Name and Topic.  I appropriatly have the C++ program send correct
information the the correct DDE Server.  The VFP DDE Server parses the input
and information files then generates the correct output document.

It kicks ass...

Thank for all your help.

     KMP

PS. I will make the code available shortly.
      \\\|///
     \\ ~ ~ //
     (/ @ @ /)
--oOOo-(_)-oOOo---
  Kevin Pirkl

########################
Re: Is VFP Multi-threaded?

: In article <544685143wnr@pjhodey.demon.co.uk> Phil Hodey
<Phil@pjhodey.demon.co.uk> writes:

: >Is it??

: >Will I be able to run a large query and return control to the user to
: >continue work whilst the query is executed??

: In a word, no. Not without interfacing to a back-end server.
Or running FoxPro twice on your machine.  It works under OS/2 really smoothly,
but I don't know about windows.  In theory, you could set up one program to
be the front end, and when you want to run a query, you just copy the select
statement to a QUERY.TXT file.  Your other instance of FoxPro just hangs out
in a loop until it sees the QUERY.TXT file and then runs that select
statement into a table and deletes the QUERY.TXT file.  Then it resumes
hanging out.  Your first program could then open that table (e.g. RESULT.DBF)
and show it to you.

I refer you once again to the part that says 'in theory'.  In other words,
I have never tried this.

Good luck; post here if you try it and let me know how it works.

Yours,

Chris

P.S.  It would probably do you well to run the runtime versions of FoxPro
and not the full version-- it will save on resources.



Index

VFP - NEW GENDBC

Microsoft has release a new version of the Gendbc.prg that ships with
VFP.
As you may already know the original version of Gendbc.prg did not
recreate
filters on existing table indexes.  The good news is that they did
enhance
the program to support filter expressions on CANDIDATE keys.  The bad
news
is that the language does not support the recreation of filter
expressions
on PRIMARY keys.  The best they could do with this new version is warn
you if you have filter expressions on primary keys.  Mostly I would use
the filter !DELETED() for primary keys so I could recycle my records in
a multi user environment.  If you need to recreate a database from
scratch
Gendbc.prg can save tons of work, however, you must use the visual tool
to add filter expressions to a primary key index.  Just be fast about it
before all your resources 'leak' out. :)  This program is available on
Microsoft's ftp site, it's named 'nwgendbc.exe' this is a
self-extracting
exe that expands to about 40k.  Below is a portion of the readme.txt
that
comes with it.

readme.txt
In response to customer feedback, Microsoft is releasing an update to
the

GENDBC utility that ships with Visual FoxPro for Windows.  The updated
version

of the GENDBC utility includes the following enhancements:

  - Better lookup for adding Referential Integrity information to
databases

  - Added support for filter expressions on CANDIDATE keys



Index

VFP - OBJECT CLASS INVALID FOR CONTAINER

From: "Paul Russell" <prussell@fox.nstn.ns.ca>
Subject: RE: VFP: Whats this error message?

In message Wed, 28 Jun 1995 18:01:09 -0400, SwedeNJ@aol.com  writes:

> Can someone please tell me what the following error message means and how
> to correct the problem?
>
> Error Loading file - Parent Record #5
> Object class is invalid for this container.

The only time that I got this was after I had changed the number of pages in
a page frame to 3, set up a form with a 3 page frame (and filled in the
pages), then reduced the number in the class to 2.  The page in the form had
information for a page 3 that didn't exist (because it took the default
number of pages from the class).  Once I changed the class back to 3 pages,
everything worked.

Hope this helps.


Index

VFP - OCX - MSCOMM32.OCX

Date: Thu, 21 Mar 96 21:23:00 UT
From: "Brian Mair" <Brian_m@msn.com>
Subject: Communications Control

I am some luck, but mostly trouble using the Communications Control
(MSCOMM32.OCX)

The following will work once, but not a second time, unless I turn off my
modem (sportster Vi 28,800), then back on.

Thisform.CommCtrl.CommPort = 1
Thisform.CommCtrl.Settings = "9600,n,8,1"
Thisform.CommCtrl.InputLen = 0
ThisForm.CommCtrl.PortOpen = .T. &&Open Com port
Thisform.CommCtrl.InBufferCount = 0     && Flush the input buffer
Thisform.CommCtrl.Output = "ATDT" + CHR(13) + CHR(10)   && Produces dial tone
ThisForm.CommCtrl.PortOpen = .F.

If anyone is using the control successfully, am I doing something wrong ?

Brian Mair
brian_m@msn.com


******************************
Date: Fri, 22 Mar 1996 10:49:46 +-200
From: "C. Alexandratos" <antl@hol.gr>
Subject: RE: Communications Control

I haven?t tried it in VFP but it works in VB 4.0. The trick is to close and
reinitialise your port each time. eg:

if 
	close port
endif
open port
send control codes to the modem
do the dialing..


Another trick that might come handy is that when communicating in a
terminal mode and you want to send data, sending something will fill up the
receive buffer (because of the echo settings of the terminal) and you have
to immediately clear the input buffer before receiving any response.

*************************

Date: Fri, 22 Mar 96 13:03:13 UT
From: "Eric Brassell" <EBRASS@msn.com>
Subject: RE: Communications Control

Try setting the handshaking property to something other than 0.

----------
Date: Fri, 22 Mar 96 13:43:03 UT
From: "Brian Mair" <Brian_m@msn.com>
Subject: RE: Communications Control

Thanks Eric !

Setting the handshaking property from the default of 0-None to 1-XON/XOFF
didn't work, but setting to 2-RTS/CTS or 3-Both works great. I can finally
proceed with the application. Thanks again.

Brian Mair

************************
Date:          Fri, 22 Mar 1996 09:05:29 -0600 (CST)
From: "Trammell, Mike" <MTRAMMELL@wic.tdh.state.tx.us>
Subject:       Re: Communications Control

I haven't used the OCX yet, so I don't know what the command would be, but
I do see the problem.  After you produce the dial tone, you are closing the
port before releasing the phone line (ie.. the phone line is still open).
Send a command Thisform.CommCtrl.Output = "ATZ+ CHR(13) + CHR(10)"
			(usually resets & hangs up)
before the command Thisform.CommCtrl.PortOpen = .F..

************

Index

VFP - OLE AND WORD7

Date: Tue, 2 Apr 96 22:37:52 UT
From: "Brian Mair" <Brian_m@msn.com>
Subject: VFP: OLE Auto & Word question(2)

I'm testing a simple OLE Automation session with Word 7, and have two
questions for anyone who's tried something similar. Documentation on this
seems to be alot better for Visual basic - I can't find any VFP stuff.

The DoVerb(-2) displays the document in a the full Word Window, but the page
is only one character wide (ie: Hello World is vertical).

Second, is there a way to embedd a document in a general field, wihout first
creating the document on disk ?

*The Code:
PUBLIC WrdObj
WrdObj=CREATEOBJECT("Word.Basic")
WrdObj.FileNewDefault
WrdObj.Insert("Hello World")
WrdObj.FileSaveAs(CURDIR()+"temp.doc")
WrdObj.AppClose
SELECT formletr
GO TOP
APPEND GENERAL letter FROM CURDIR()+"temp.doc" CLASS WORD.DOCUMENT.6
ThisForm.oleBoundControl1.DoVerb(-2)
WAIT WIND
RETURN

Thanks
Brian Mair
brian_m@msn.com


Index

VFP - OLE OUTLINE CONTROL

Date: Wed, 01 Nov 1995 19:57:19 -0500
From: pallor@ibm.net (Paul Allor)
Subject: VFP: OLE Outline - Expand

I'm trying to set up a form useing the outline control.
I don't like that the only way to expand/contract a branch is with +,-
What I want is if I 2Click or enter on a branch it expands/contracts as
appropriate.  That was the plan.  What I ran into though is that there
are things documented that don't seem to exist in the implementation of
the object.  Specificaly, the Expand property doesn't seem to exist.
and, there seems to be 2 Enabled properties!.  Here is an edited
disp obje like:

Object: Z                            Pub       O    OLECONTROL

Class Tree:
        OLECONTROL

Properties:
        CLASS                                       C    "Olecontrol"
===>    ENABLED                                     L    .T.
===>    ENABLED                                     L    .T.
        MOUSEICON                                   O    OUTLINE CONTROL

The second Enabled is where Expand should be (alphabeticaly), coincidence?

When I x=create("ol_class") the array x.oline.expand[] doesn't exist.
It seems that the IsItemVisible is missing too....

Also documented is an Expand *Event*.  How can I TRIGGER it?

Am I doing something wrong?  Is there no way to expand a branch
within code? (keyb "+" does not work)  OR, does anyone know if there is
an updated Outline OLE class available from Micro$oft that works the way
the help file says?

BTW I've also built a fairly neat routine that will search down subdirs
using recursive calls to itself for all occurances of a given filename.
If anybody would like a copy of it, say the word...(like dir system.dbf /s/b)

Some more info from the helpfile:
Expand Property (Outline Control)

Specifies whether an item is expanded (subordinate items are visible).

Syntax: [Form.]Outline.Expand(nIndex)[ = lExpression]

The settings for the Expand property are:

Setting Description
.T. The item has expanded and its subordinate items are visible.
.F. The item's subordinate items, are collapsed and, therefore, hidden.

Remarks
Not available at design time and read-write at run time.
The Expand property gives you programmatic control over expanding and
collapsing subordinate items. This can be useful when the Outline control is
context-sensitive in relation to other control values.
If an item is collapsed and you set Expand to true (.T.), the Outline
control generates the run-time error "Parent Not Expanded."
If the Expand property is set to true (.T.), the Expand event occurs.


Index

VFP - OLE, WORD6/7

Subject:
            Help Please with VFP and OLE to WORD 6/7
       Date:
            Fri, 24 May 1996 04:21:56 GMT
       From:
            gweb@execpc.com (George Webster)
Organization:
            Unknown
 Newsgroups:
            microsoft.public.fox.programmer.exchange





: ***  in MS Word I have a template -  labels.doc
: ***   with a macro called labels which when invoked performs
: ***   a mailmerge with labels.dbf to produce labels.doc
: ***   a two-up mailing labels report.
: ***
: ***   all I want to do is use OLE from Visual Foxpro to Word
: ***   to execute this macro - it means my customer does not
: ***   have to bother running word after finishng the VFP app.
: ***
: ***     I have looked at all the documentation I can find but
: ***   nowhere can I find reference to invoking a MS Word Macro.
: ***   Indeed it may not be possible, but if it is it would sure
: ***   make life easy in this particular instance.
: ***   The code below whilst it passes VFP's syntax checking
: ***   produces a Program Error Dialog with the message:
***    ' OLE IDispatch exception code 537 from Microsoft Word.
***     Unable to run macro specified.'
***    when executing the ToolsMacro line.
***
***   prior to the error
***   Word loads, the template is loaded and visible
***    and Word maximizes - then nothing
***   after minimizing Word I can see the Program error Dialog box
***    and if I hit the macro start keys, the macro will execute
perfectly
***
***   any Help or suggestions will really be appreciated.
***
***    this is the offending code below


private wordOle as object

if file("c:\eti\labels\labels.doc")
        delete file c:\eti\labels\labels.doc
endif

wordOle = CREATEOBJECT("Word.Basic")
wordole.appshow
wordOle.FileOpen("c:\eti\labels\labels.dot")
wordOle.AppMaximize
wordOle.ToolsMacro("labels",1)

RELEASE wordOle





Index

VFP - READ ONLY FORMS

Path:
opera.iinet.net.au!disco.iinet.net.au!news.uwa.edu.au!munnari.OZ.AU!spool.mu.ed
u!pravda.aa.msen.com!news1.best.com!news.texas.net!imci2!news.interne
From: TRW@medcal1.csustan.edu (Tim Witort)
Newsgroups: comp.databases.xbase.fox
Subject: Re: VFP 3.0: Read-only Table at Run-time???
Date: Thu, 04 Apr 1996 09:26:16 -0800
Organization: Information Resources and Technology
Lines: 21
Message-ID: <4YAZx0DcBkPX083yn@medcal1.csustan.edu>
References: <4jrht8$2ng@jaring.my> <4jv8ee$dja@uuneo.neosoft.com>
NNTP-Posting-Host: medcal1.csustan.edu

In article <4jv8ee$dja@uuneo.neosoft.com>,
emerson@neosoft.com (Emerson Staup) wrote:
> ctchang@pl.jaring.my (KC Lee) wrote:
>
> >Hi! I've compiled my application and found that all the Forms I have are
> >Read-only. I have also set the Exclusive to ON ... but the same situation
> >stays. (Note: All the forms work fine during Development Mode). Most of the
> >forms are created using the Forms Wizard ... but there are some which I
> >created from a Blank Form.
>
> >Anyone faced this problem before? Would appreciate any help given. Thanks in
> >advance.
>
> I believe you have included your tables in the data enviroment for the
> forms.

Close.  If you include your database in the project, the tables will
be read only.  Don't build the data into the application in this way
and it should be modifiable.

-- Tim

Index

VFP - REFERENTIAL INTEGRITY ERROR ROUTINE

Date: Wed, 20 Mar 1996 10:57:43 -0500
From: "Timothy A. Callahan" <tacallah@hyrax.iupui.edu>
Subject: Re: How I capture error messages

At 09:21 AM 3/20/96 CST, Jose Araya wrote:
>How I capture error messages sent by the database.  For example, I know
>that with the command ON ERROR I can capture messages sent by the
>application but not the ones by the database.
>How doI capture a message like : "uniqueness of index  is violated"
>or "trigger failed". Also how can I obtain parameters like  from
>the previous example.
>
>I'm working with Visual FoxPro with Windows 3.1

Here is post I replied to a couple days.  I think it answers your question.
Let me know if you need more.

At 05:14 PM 3/18/96 CST, Carlos Bastos wrote:
>I'm new in VFP.
>How to write my own messages
>in Referential Integrity?
>
>VF display trigger fail: insert rule violated
>
>What's more standard and usefull,
>use stored procedures, or
>use on error,
>or other one?

I handle RI failures in my Error event of my form.  For example, when I am
ready to commit my data, I do a the following:

IF NOT TABLEUPDATE(.T.) && If data was not saved...
  = AERROR(laError)     && Determine error code
  ThisForm.Error(laError[1], PROGRAM(), LINENO(1))
                        && Call error routine
ENDIF

In my Error event in my form, I have the following code:

LPARAMETERS tnError, tcMethod, tnLine
LOCAL laError [1]

* Load error information

= AERROR(laError)                                && Load error information

* Display error message(s)

DO CASE
  CASE tnError = 1539                            && Trigger failed
* laError [5] indicates failing trigger
    ThisForm.PromptUser(tnError, .F., ALIAS(), laError [5])
                                                 && Inform user of trigger
failure
  CASE tnError = 1582                            && Field rule violated
* laError [3] contains the name of the field involved in violation
    ThisForm.PromptUser(tnError, .F., ALIAS(), laError [3])
                                                 && Inform user of field
rule violation
  CASE tnError = 1583                            && Table rule failed
    ThisForm.PromptUser(tnError, .F., ALIAS())   && Inform user of table
rule violation
  CASE tnError = 1884                            && Primary key violated
    ThisForm.PromptUser(tnError, .F., ALIAS())   && Inform user of primary
key violation
* Other form specific cases:
ENDCASE

RETURN

The PromptUser method is where I popup a MessageBox or Wait Window to the user.

Timothy A. Callahan
tacallah@eval.iupui.edu


Index

VFP - REPORT DATA ENVIRONMENT

Date: Tue, 19 Dec 95 10:36:22 PST
From: Arnon Gal-Oz <ontime@NetVision.net.il>
Subject: RE: VFP:Prob (Try this !) BUG ???

>Wierd Problem !!!
>
>Try this with any database (i've used EMPLOYEE.DBF)
>
>SELECT * FROM employee INTO DBF MYFILE
>CREATE REPORT TEST
>
>1) Try to add fields using the Textbox Expression Builder ... the fields are
>not    available !!! - but global varaiables are !.
>
>2) Now try the Quick Report option from the Report Menu ! ... Huh ! the
>fields    appear ! Magic !!!.
>
>Can anyone tell me why this happens and why the DBF is not automatically
>available in the DATAENVIRONMENT ???

if u will look u'd see that even if u USE EMPLOYEE it will not be available as
well.
as opposed to 2.x when the environment was all the tables currently open
in VFP you only the tables u spcify are added to the DE - or like u noticed u
can use the quick report option
btw, if u want to use the results of a query in a report u can use a view
(instead of a .DBF or CURSOR) and add it to the DE

HTH

Arnon Gal-Oz

Index

VFP - ROW BUFFERING AND UPDATES

Date: Tue, 20 Feb 96 17:01:21 PST
From: Arnon Gal-Oz <ontime@netvision.net.il>
Subject: RE: VFP - Row Buffering

>
>         I've got a VFP problem that I'm sure has an easy answer.  I
>         built a simple little formset that has one form and a
>         navigation toolbar.  While testing the form, I noticed that
>         any edits I make to text fields are not saved to the
>         database unless I tab out of the text box before issuing a
>         TABLEUPDATE().  It seems that the VFP buffer is not updated
>         until the control loses focus.  Here's what happens:
>
>         Edit text box, move to next record (explicitly issuing
>         TABLEUPDATE(.T.,.T.)):  EDIT IS NOT SAVED
>
>         Edit text box, move off of the text box control, then move
>         to next record: EDIT IS SAVED PROPERLY
>
>         Is this standard VFP behavior?
changes to fields are not commited until u leave the field
this is true to whether the table records are buffered or not

Arnon Gal-Oz



Index

VFP - RULES and TRIGGERS, FIRING ORDER

Date: Wed, 16 Aug 95 10:11:56 -0400
From: "Miles Thompson" <mthompso@fox.nstn.ns.ca>
Subject: Re: VFP:Generating Keys

Tim,

Are you experimenting with this "bare bones" - i.e. working from the
Database Designer and command window? or in a form? If the latter, try it
"bare".

Are you working on tables or on a view?

This looks like a key field. What's the update property? Is the field
updateable?

Do you have any other rules on the table, namely COLUMN, ROW, or UNIQUE
(index)? They all fire before INSERT when Buffering is off(set to 1).
Changing Buffering changes the firing behaviour.

I'd suggest downloading "Firing Order for Rules and Triggers in Visual
FoxPro", knowledge base article Q13467. It sets up and walks you through an
example of the firing order--and I think it's slightly off in or two spots.
It was late last evening when I was playing with it.

Finally, have you noticed the general comment on triggers is "Gee,
tremendously important feature and vital for ...". I have not seen in
any of the VFP documentation, FoxTalk, FoxPro Advisor, Databased Advisor a
working example of triggers in use. The tastrade application does use them,
but the implementation is not "skeletal".

There could be a lot of content here for a seminar ...
"How to Use Views and Triggers in Visual FoxPro"

Regards, and keep us posted,

Miles Thompson

P.S. One comment on your design - why do you not fetch your next key from a
"system" table. As you have this implemented I would think several users
could inadvertently get the same key. When you are using VFP's
buffering scheme your APPENDed  INSERTed SQL records are in a third buffer.
The source is not refreshed until =TableUpdate(.T.) (or other params) is
issued.
Mt

On Mon, 14 Aug 1995 17:29:24 -0500,
Tim Callahan  <tcallah@eval.iupui.edu> wrote:

>Has anyone been able to generate primary keys in VFP 3.0?  I tried calling
>the following code from my Insert Trigger.  When I insert a record into my
>database, I get "Cannot update the cursor."  I plan on using row or table
>buffering.
>
>FUNCTION InsertTrigger
>
>LOCAL cTable, nCurrArea, nNum
>
>nCurrArea = SELECT()
>cTable = DBF()
>
>SELECT 0
>USE (cTable) AGAIN
>SET ORDER TO Num
>GO BOTTOM
>nNum = iNum + 1
>USE
>
>SELECT (nCurrArea)
>REPLACE iNum WITH nNum  && Blows up here
>
>RETURN .T.
>
>ENDFUNC
>
>Timothy A. Callahan
>tcallah@eval.iupui.edu
 ---------------------------------------------------------------------
 Miles Thompson                                           P.O. Box 82
 CQA Consulting Group                                     Enfield, NS
 mthompso@fox.nstn.ns.ca                                  Canada
 Voice: 902-883-1010 Fax:902-883-8586                     B2T 1C6
 ---------------------------------------------------------------------

######################
Date: Wed, 16 Aug 1995 11:19:56 -0500
From: tcallah@eval.iupui.edu (Tim Callahan)
Subject: Re: VFP:Generating Keys

On Wed, 16 Aug 95 10:11:56 -0400, Miles Thompson wrote:
>Are you experimenting with this "bare bones" - i.e. working from the
>Database Designer and command window? or in a form? If the latter, try it
>"bare".

I am trying the "bare bones" approach.

>Are you working on tables or on a view?

Table.

>This looks like a key field. What's the update property? Is the field
>updateable?

Yes, the field I was trying to update is the primary key and has an index
indicating so.  I am not too sure mean by the "update property."  This leads
me to another question: Are database objects inherited from cursor objects?
How do I set the values of the properties of a database object?  Can I only
use functions or commands, like CURSORSETPROP() or SET FILTER, or can I do
something like this: something.mytable.filter?  I would think there would a
method in the Cursor Object to set or get the filter for example.  I looked
under help for Cursor Object, and I so the properties but no methods.  Can
someone straighten me out here?

>Do you have any other rules on the table, namely COLUMN, ROW, or UNIQUE
>(index)? They all fire before INSERT when Buffering is off(set to 1).
>Changing Buffering changes the firing behaviour.

I have a primary index as I mentioned earlier.  I tried
CURSORSETPROP("Buffering", 5) and also setting buffering to 1.  Both give
the "Cannot update the cursor" error.  It seems to me that fields in the
database for which the triggers occur cannot be updated in the Trigger
rouintes.  Is this true?

>I'd suggest downloading "Firing Order for Rules and Triggers in Visual
>FoxPro", knowledge base article Q13467. It sets up and walks you through an
>example of the firing order--and I think it's slightly off in or two spots.
>It was late last evening when I was playing with it.

I was putting MessageBox in my Triggers and Validation Rule to see what is
called and when.

>Finally, have you noticed the general comment on triggers is "Gee,
>tremendously important feature and vital for ...". I have not seen in
>any of the VFP documentation, FoxTalk, FoxPro Advisor, Databased Advisor a
>working example of triggers in use. The tastrade application does use them,
>but the implementation is not "skeletal".

One thing I found yestday in the tastrade APP was that they were calling
newid() as there default value to generated ID's.  I think this is approach
I will take.

>There could be a lot of content here for a seminar ...
>"How to Use Views and Triggers in Visual FoxPro"

Yes, lots of new stuff!

>Regards, and keep us posted,
>
>Miles Thompson
>
>P.S. One comment on your design - why do you not fetch your next key from a
>"system" table. As you have this implemented I would think several users
>could inadvertently get the same key.

This is true.  I was trying to get it to work, and I was not worried about
integrity .  I like the system table approach.  This is basically what I
did in FPW 2.6a.  Would you suggest recycling unused or deleted ID's?  I
noticed the newid function in tastrade does not recyle ID's.

>When you are using VFP's buffering scheme your APPENDed  INSERTed SQL records
>are in a third buffer. The source is not refreshed until =TableUpdate(.T.)
>(or other params) is issued.

Yep. Thanks for input!

[Deleted my original post]

Timothy A. Callahan
tcallah@eval.iupui.edu



Index

VFP - SETUP WIZARD ERROR

On Sat, 28 Oct 1995, Jim L. Sorensen wrote:

> Product: Visual FoxPro Professional Edition (SETUP WIZARD)
> While trying to install from distribution disk #1, I receive the following
> message: "Setup Was Not Completed Successfully".  No other message appears
> or gives any clue as to "why" the installation failed.

Try deleting everything in the copyright information field in the Setup
Wizard.  There's a bug which causes the setup to choke if your copyright
info is over a certain length.  Sorry, I've misplaced the Knowledge Base
article which provides the specifics on it, but it's in there somewhere.

Interestingly enough, Microsoft denies that it's a bug, claiming that
"this behavior is by design".  Go figure.  =)

.-------------------------------------------------------------------------.
|  John Doppler                                Test your trivia skills!   |
|  doppler@primenet.com                http://www.primenet.com/~doppler   |
`-------------------------------------------------------------------------'


Index

VFP - SQL VIEWS IN DBC

Date: Sat, 28 Oct 1995 19:45:27 -0700
From: Kirby Urner <pdx4d@teleport.com>
Subject: VFP: non-visual SQL views in dbc (good news)

Apologies if this is posted twice...

SUMMARY: programmatic SQL views bypass limitations of visual
view-builder when defining database container.

One piece of good news about VFP is that the visual SQL builder
is not the last word on view creation.  Views are pseudo-tables
in database containers which pull together data from real, raw
data tables, creating synthetic, synergetic views via SQL. Views
can build on other views, pyramid fashion, like in Access, to
populate the container with enriched, vitamin-packed, data tables,
much closer to what end users would really want and need.

But the visual query builder is only so-so.  Really complex
SQL, or even semi-tough, with parenthetical nested ands 'n ors
and what not, can't be constructed visually. And forget about
stuff like SELECT blatt FROM table WHERE blatt NOT IN (SELECT...).

The good news is one can define SQL views programmtically,
avisually, and still get those views to appear in the dbc.
They show up as tables, and when you click on 'em, they activate
and show columns in a browse window, like good little views
should. But if you click on Modify, they say 'Feature Not
Available' because the behind-the-scenes SQL is too
sophisticated and blows the visual builder's mind.  I'm glad to
find this out.

But all the while, scrolling around in the database container,
admiring the view(s), I watch my GDI and System resources
depleting to zero in Windows 95. That's the bad news:
VFP+Win95=RebootCity (must exit VFP way too often, so no
go for clients until maintenance release is available --
any positive rumors in this regard would be most welcome).

Kirby
------------------------------------------------------------
Kirby Urner & Dawn Wicca   "All realities are virtual" -- KU
Email: pdx4d@teleport.com
Web:   http://www.teleport.com/~pdx4d/


Index

VFP - SYSTEM REQUIREMENTS

Subject: RE: Can VFP run in Win 3.11 ? How much RAM required?

In message Tue, 27 Jun 95 10:49:28 CST, domingur@iscclink.is.qms.com  writes:

> Does VFP REQUIRE Win NT, Win95, or Windows for Workgroups-
> can it run at all with Win 3.1 & 16mb ram?
>
> We have plans to phase Win95 in, but it'll take a while.

At this point, VFP will run under Win 3.1, but it is slow.  VFP has to run
in a 32 bit environment, which WIn 3.1 is not, so it has to bring load
Win32S.  When you run this 32 bit kludge in a graphical environment (that is
not connected to the OS) over DOS, it tends to be slow.  Win '95, OTOH, is
much faster and more suitable for VFP.

If you will be sticking with Win 3.1 for the short to mid term, then I would
suggest going with FP 2.6


Index

VFP - TEXTBOX CLASS

Date: Thu, 1 Feb 1996 16:27:27 +0000
From: "Mike Chalk" <fs33@dial.pipex.com>
Subject: VFP  Editbox enhancement

I was asked just recently for a method of allowing users to treat
memo edit boxes like normal boxes when they move through the fields
on a form by just pressing .  You can use  but that is
messed up if you allow tabs in a memo, also  rather than 
makes for a more consitant feel to a form.  Moving with a mouse can
be a real irritation for users entering lots of text in a form.  The
demo below includes my editbox base class which addresses the
problem.

Sorry the posting is so long (especially for non VFPers) but
I thought it may be useful to some foxfolk out there.  Anyone out
there got their own VFP snippets they would like to share?

Mike

******** Copy from here, paste into an empty .prg and run

oTestForm=CREATEOBJECT("Form")
WITH oTestForm
  .WindowType=1                   && set modal to avoid using READ EVENTS for
demo
  .Autocenter=.T.
  .Caption="Move between editboxes without tabs or mouse!"
  .Width=550
  .Height=250
  .Addobject("oText1","TextBox")  && add an ordinary text box control
  WITH .oText1
	  .Top=20
	  .Left=50
	  .Width=450
	  .Value="Standard text box, press enter"
	  .Visible=.T.
  ENDWITH
  .Addobject("oEdit1","TestEdit")  && add an enhanced edit box control
  WITH .oEdit1
    .Left=50
    .Value="Try pressing enter as soon as the cursor focuses here"
    .Visible=.T.
  ENDWITH
  .Addobject("oEdit2","TestEdit")  && add an enhanced edit box control
  WITH .oEdit2
    .Left=300
    .Value="Add some of your own text and then press enter twice"
    .Visible=.T.
  ENDWITH
ENDWITH

oTestForm.Show

DEFINE CLASS testedit AS EnhancedEditBox  && Subclass EnhancedEditBox
    .Width=200
    .Top=50
    .Height=150
ENDDEFINE

**************************************************************************
*  Mike Chalk   ASAD SYSTEMS Ltd.    mikechalk@dial.pipex.com      ENGLAND
**************************************************************************
*
*  Enhanced editbox base class - A user can use the enter key to step
*  through editbox fields by pressing  (avoiding having to press
*  tab or mouse click to move through a form which includes memo edit
*  boxes).  Focus is shifted past the edit box if  is the first
*  key press or if  is pressed twice at the end of the memo.
*  You can also force the memo field to be upper case if you set
*  property lUppercase=.T. or if you enter a ! in the editbox format
*  property (like formatting a text box).
*
**************************************************************************

DEFINE CLASS EnhancedEditbox AS Editbox

  lUppercase = .F.        && Set to .T. if you want to force upper case
  lEnhanced = .T.         && Set to .F. to switch of enhancements

  Name = "aeditbox"

  PROTECTED lAllowTabs    && Remembers status of allowtabs property
  PROTECTED nNewKeyCode   && Holds the current key pressed
  PROTECTED nOldKeyCode   && Holds the key before this one

  PROCEDURE GotFocus
    This.nNewKeyCode=0    && initialise nKeyPress to indicate next key
                          && pressed is the first in this editing session

    This.AllowTabs=This.lAllowTabs && reset allow allow tabs in case it
                                   && was changed by me last session
    ENDPROC

  PROCEDURE Init

    This.lAllowTabs=This.AllowTabs    && remember allow tabs setting

    * Force upper case if put ! in the format (like a texbox control)

    IF This.lEnhanced AND ('!' $ THIS.format)
      This.lUppercase=.T.
    ENDIF
    ENDPROC


  PROCEDURE KeyPress
    LPARAMETERS nKeyCode, nShiftAltCtrl

    * If escape is pressed then reset as if nothing has been entered
    * Otherwise remember the last key pressed and the current key

    IF nKeyCode=27
      This.nNewKeyCode=0
    ELSE
      This.nOldKeyCode=This.nNewKeyCode   && roll over key presses
      This.nNewKeyCode=nKeyCode	          && now remember this key press
    ENDIF

    * Force upper case if required

    IF This.lUppercase AND BETWEEN(nKeyCode,97,122)
      KEYBOARD UPPER(CHR(nKeyCode))
      NODEFAULT
    ENDIF
    ENDPROC


  PROCEDURE InteractiveChange

    * Terminate edit if the first key pressed is an Enter (so you can
    * move through the fields by pressing enter.  Also terminate if
    * you have pressed Enter twice at the end of the memo field

    LOCAL cValue

    IF This.lEnhanced AND This.nNewKeyCode=13 AND ;
      (This.nOldKeyCode=0 OR ;
       RIGHT(This.Value,4)=CHR(13)+CHR(10)+CHR(13)+CHR(10))

      * Remove leading and trailing blank lines from the memo

      cValue=THIS.value
      DO WHILE LEFT(cValue,2)=CHR(13)+CHR(10)
        cValue=SUBSTR(cValue,3)
      ENDDO
      DO WHILE RIGHT(cValue,2)=CHR(13)+CHR(10)
        cValue=LEFT(cValue,LEN(cValue)-2)
      ENDDO

      This.value=cValue
      This.AllowTabs=.F.    && make sure tab will terminate this edit
      KEYBOARD CHR(9)       && stuff the keyboard with a tab to move on
    ENDIF
    ENDPROC

ENDDEFINE                   && EnhancedEditbox

******** End of demo and class definition


Index

VFP - UPDATE ERROR - TABLE IN USE

Date: Mon, 26 Feb 1996 09:10:02 -0500 (EST)
From: Henry Carver <hv9@ornl.gov>
Subject: Re: table is in use by another user

At 03:00 PM 2/24/96 CET, you wrote:
>I quite often receive an error while working with table buffering
>that a table is in use by another user, but in fact I am the
>only one who can use it (no network).
>
>What is the reason?
>Thankyou in advance.
>
>
This is a copy of a post dealing with the "same?" problem.

At 08:50 AM 2/7/96 PDT, you wrote:
>Frans Meijer wrote:
>>When I'm editing a record in a grid I someyimes get the error message =
>>"Record is in use by another user". This is a strictly single-user =
>>situation. It happens when I try to modify another field in the same =
>>record; i.e. I change one field, then TAB to another, try to change it =
>>/et voila/...
>
>This is almost certainly a bug. I've seen it in both grids and browses.
>Here's one way to reproduce it:
>
>SET DELETED OFF
>create table blah free (key c(5))
>insert into blah values ("AAAAA")
>=cursorsetprop('buffering',5,"blah")
>insert into blah (key) values ("BBBBB")
>BROW
>
>Then, in the browse window, click the delete column of the first record.
>The following message appears: "Record is in use by another user".
>
>I've reported it to the evil empire, but in the meantime perhaps someone
>knows a workaround.
>
>
>Jon Reinsch                         NOAA HMRAD
>reinsch@hazmat.noaa.gov             7600 Sand Point Way NE		
>(206)526-6947                       Seattle, WA  98115
>

Jon,

Perform an "unlock" after the "insert into" to release the header
You will still need to perform the necessary error checks etc.


Henry (hv9@ornl.gov)


********

Date: Mon, 26 Feb 1996 09:24:44 -0500
From: "Yubun Chiu" <chiuyu@pwgsc.gc.ca>
Subject: re: Re: table is in use by another user

Try this:

set exclusive off before open any database

Hope this can help.

Regard Vicent

Hosted by uCoz