Click to See Complete Forum and Search --> : Buffering and multiple instances of a form


Donna Lioy
03-21-2000, 05:44 PM
I am using optimistic row buffering and running multiple instances of a form.
When I update a record using table update you have to move the cursor to
reflect the changes.
Is there anyway to refresh table. When I start a second instance of the form
I want it to display the new data but it does not
do so until I move the cursor to the next record. Adding a refresh to the
activate form does not seem to work.
Any information available would be greatly appreciated.

Fred Taylor
03-21-2000, 06:41 PM
Are you sure you're using TABLEUPDATE on the correct table? If you were,
you should be able to see your new record.

Fred


Donna Lioy wrote in message <38d7ed4e@news.devx.com>...
>
>I am using optimistic row buffering and running multiple instances of a
form.
>When I update a record using table update you have to move the cursor to
>reflect the changes.
>Is there anyway to refresh table. When I start a second instance of the
form
>I want it to display the new data but it does not
>do so until I move the cursor to the next record. Adding a refresh to the
>activate form does not seem to work.
>Any information available would be greatly appreciated.

Nancy Folsom \(MS FoxPro MVP\)
03-21-2000, 06:56 PM
"Donna Lioy" <dlioy@funcentersoftware.com> wrote in message
news:38d7ed4e@news.devx.com...

> I am using optimistic row buffering and running multiple instances of a
form.
> When I update a record using table update you have to move the cursor to
> reflect the changes.
> Is there anyway to refresh table. When I start a second instance of the
form
> I want it to display the new data but it does not
> do so until I move the cursor to the next record. Adding a refresh to the
> activate form does not seem to work.
> Any information available would be greatly appreciated.

Are the controls on a pageframe? If so, you need a this.refresh() in the
page activate() method. What is your SET('REFRESH')?

Otherwise, it is working alright for me, as the following quick example
shows.

*!* Begin code
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN


**************************************************
*-- Form: form1 (c:\nec\library\classes\temp.scx)
*-- ParentClass: form
*-- BaseClass: form
*-- Time Stamp: 03/21/00 03:54:07 PM
*
DEFINE CLASS form1 AS form


DataSession = 2
Top = 0
Left = 0
Height = 138
Width = 362
DoCreate = .T.
Caption = "Form1"
Name = "Form1"


ADD OBJECT txtpsiid AS textbox WITH ;
Comment = "", ;
ControlSource = "DaysOfWeek.nid", ;
Height = 23, ;
Left = 9, ;
TabIndex = 2, ;
Top = 8, ;
Width = 122, ;
Name = "txtPsiid"


ADD OBJECT txtpsi AS textbox WITH ;
Comment = "", ;
ControlSource = "DaysOfWeek.cDayOfWeek", ;
Height = 23, ;
Left = 9, ;
MaxLength = 12, ;
TabIndex = 4, ;
Top = 36, ;
Width = 122, ;
Name = "txtPsi"


ADD OBJECT command1 AS commandbutton WITH ;
Top = 106, ;
Left = 273, ;
Height = 27, ;
Width = 84, ;
Caption = "Refresh Form", ;
Name = "Command1"


ADD OBJECT command3 AS commandbutton WITH ;
Top = 106, ;
Left = 97, ;
Height = 27, ;
Width = 84, ;
Caption = "Add record", ;
Name = "Command3"


ADD OBJECT command4 AS commandbutton WITH ;
Top = 67, ;
Left = 40, ;
Height = 27, ;
Width = 30, ;
Caption = "<<", ;
Name = "Command4"


ADD OBJECT command5 AS commandbutton WITH ;
Top = 67, ;
Left = 71, ;
Height = 27, ;
Width = 30, ;
Caption = ">>", ;
Name = "Command5"


ADD OBJECT command6 AS commandbutton WITH ;
Top = 106, ;
Left = 9, ;
Height = 27, ;
Width = 84, ;
Caption = "Start another", ;
Name = "Command6"


ADD OBJECT command7 AS commandbutton WITH ;
Top = 67, ;
Left = 9, ;
Height = 27, ;
Width = 30, ;
Caption = "|<<", ;
Name = "Command7"


ADD OBJECT command8 AS commandbutton WITH ;
Top = 67, ;
Left = 103, ;
Height = 27, ;
Width = 30, ;
Caption = ">>|", ;
Name = "Command8"


ADD OBJECT command9 AS commandbutton WITH ;
Top = 106, ;
Left = 185, ;
Height = 27, ;
Width = 84, ;
Caption = "Save it.", ;
Name = "Command9"


ADD OBJECT label1 AS label WITH ;
AutoSize = .T., ;
Caption = "Label1", ;
Height = 17, ;
Left = 189, ;
Top = 14, ;
Width = 40, ;
Name = "Label1"


PROCEDURE Activate
this.refresh()
ENDPROC


PROCEDURE Load
SET EXCLUSIVE OFF
IF FILE('daysofweek.dbf')
USE daysofweek SHARED
ELSE
CREATE TABLE DaysOfWeek( nID N (8), cDayOfWeek C (9) )
INSERT INTO DaysOfWeek(nID, cDayOfWeek) VALUES ( SECONDS()*1000,
DOW( DATE() ) )
INSERT INTO DaysOfWeek(nID, cDayOfWeek) VALUES ( SECONDS()*1000 +
RECNO(), CDOW( DATE() + RECNO() ) )
INSERT INTO DaysOfWeek(nID, cDayOfWeek) VALUES ( SECONDS()*1000 +
RECNO(), CDOW( DATE() + RECNO() ) )
INSERT INTO DaysOfWeek(nID, cDayOfWeek) VALUES ( SECONDS()*1000 +
RECNO(), CDOW( DATE() + RECNO() ) )
INSERT INTO DaysOfWeek(nID, cDayOfWeek) VALUES ( SECONDS()*1000 +
RECNO(), CDOW( DATE() + RECNO() ) )
INSERT INTO DaysOfWeek(nID, cDayOfWeek) VALUES ( SECONDS()*1000 +
RECNO(), CDOW( DATE() + RECNO() ) )
INSERT INTO DaysOfWeek(nID, cDayOfWeek) VALUES ( SECONDS()*1000 +
RECNO(), CDOW( DATE() + RECNO() ) )
ENDIF
SET MULTILOCKS ON
CURSORSETPROP('BUFFERING', 5, 'DAYSOFWEEK')
ENDPROC


PROCEDURE command1.Click
thisform.refresh()
ENDPROC


PROCEDURE command3.Click
APPEND BLANK IN DaysOfWeek
thisform.refresh
ENDPROC


PROCEDURE command4.Click
SKIP -1 IN DaysOfWeek
IF BOF('DaysOfWeek')
GO TOP IN DaysOfWeek
ENDIF
THISFORM.REFRESH()
ENDPROC


PROCEDURE command5.Click
SKIP 1 IN DaysOfWeek
IF EOF('DaysOfWeek')
GO BOTTOM IN DaysOfWeek
ENDIF
THISFORM.REFRESH()
ENDPROC


PROCEDURE command6.Click
do form temp.scx
ENDPROC


PROCEDURE command7.Click
GO TOP IN DaysOfWeek
THISFORM.REFRESH()
ENDPROC


PROCEDURE command8.Click
GO BOTTOM IN DaysOfWeek
THISFORM.REFRESH()
ENDPROC


PROCEDURE command9.Click
IF .NOT. TABLEUPDATE( 2, .T., 'DaysOfWeek' )
TABLEUPDATE( .T., 'DaysOfWeek' )
ENDIF
ENDPROC


PROCEDURE label1.Init
this.caption = "SET REFRESH = " + STR( SET( 'REFRESH'), 5 )
ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************

*!* End code

Donna Lioy
03-22-2000, 09:04 AM
Yes, I am sure.
I will have to retrace my code.
I must have something in there that I am just not seeing.
Thanks for your help.



"Fred Taylor" <ftaylor@uswest.net> wrote:
>Are you sure you're using TABLEUPDATE on the correct table? If you were,
>you should be able to see your new record.
>
>Fred
>
>
>Donna Lioy wrote in message <38d7ed4e@news.devx.com>...
>>
>>I am using optimistic row buffering and running multiple instances of a
>form.
>>When I update a record using table update you have to move the cursor to
>>reflect the changes.
>>Is there anyway to refresh table. When I start a second instance of the
>form
>>I want it to display the new data but it does not
>>do so until I move the cursor to the next record. Adding a refresh to the
>>activate form does not seem to work.
>>Any information available would be greatly appreciated.
>
>

Donna Lioy
03-22-2000, 09:07 AM
Thanks I will try this.


"Nancy Folsom \(MS FoxPro MVP\)" <nancy_folsom@hotmail.com> wrote:
>"Donna Lioy" <dlioy@funcentersoftware.com> wrote in message
>news:38d7ed4e@news.devx.com...
>
>> I am using optimistic row buffering and running multiple instances of
a
>form.
>> When I update a record using table update you have to move the cursor
to
>> reflect the changes.
>> Is there anyway to refresh table. When I start a second instance of the
>form
>> I want it to display the new data but it does not
>> do so until I move the cursor to the next record. Adding a refresh to
the
>> activate form does not seem to work.
>> Any information available would be greatly appreciated.
>
>Are the controls on a pageframe? If so, you need a this.refresh() in the
>page activate() method. What is your SET('REFRESH')?
>
>Otherwise, it is working alright for me, as the following quick example
>shows.
>
>*!* Begin code
>PUBLIC oform1
>
>oform1=NEWOBJECT("form1")
>oform1.Show
>RETURN
>
>
> **************************************************
>*-- Form: form1 (c:\nec\library\classes\temp.scx)
>*-- ParentClass: form
>*-- BaseClass: form
>*-- Time Stamp: 03/21/00 03:54:07 PM
>*
>DEFINE CLASS form1 AS form
>
>
> DataSession = 2
> Top = 0
> Left = 0
> Height = 138
> Width = 362
> DoCreate = .T.
> Caption = "Form1"
> Name = "Form1"
>
>
> ADD OBJECT txtpsiid AS textbox WITH ;
> Comment = "", ;
> ControlSource = "DaysOfWeek.nid", ;
> Height = 23, ;
> Left = 9, ;
> TabIndex = 2, ;
> Top = 8, ;
> Width = 122, ;
> Name = "txtPsiid"
>
>
> ADD OBJECT txtpsi AS textbox WITH ;
> Comment = "", ;
> ControlSource = "DaysOfWeek.cDayOfWeek", ;
> Height = 23, ;
> Left = 9, ;
> MaxLength = 12, ;
> TabIndex = 4, ;
> Top = 36, ;
> Width = 122, ;
> Name = "txtPsi"
>
>
> ADD OBJECT command1 AS commandbutton WITH ;
> Top = 106, ;
> Left = 273, ;
> Height = 27, ;
> Width = 84, ;
> Caption = "Refresh Form", ;
> Name = "Command1"
>
>
> ADD OBJECT command3 AS commandbutton WITH ;
> Top = 106, ;
> Left = 97, ;
> Height = 27, ;
> Width = 84, ;
> Caption = "Add record", ;
> Name = "Command3"
>
>
> ADD OBJECT command4 AS commandbutton WITH ;
> Top = 67, ;
> Left = 40, ;
> Height = 27, ;
> Width = 30, ;
> Caption = "<<", ;
> Name = "Command4"
>
>
> ADD OBJECT command5 AS commandbutton WITH ;
> Top = 67, ;
> Left = 71, ;
> Height = 27, ;
> Width = 30, ;
> Caption = ">>", ;
> Name = "Command5"
>
>
> ADD OBJECT command6 AS commandbutton WITH ;
> Top = 106, ;
> Left = 9, ;
> Height = 27, ;
> Width = 84, ;
> Caption = "Start another", ;
> Name = "Command6"
>
>
> ADD OBJECT command7 AS commandbutton WITH ;
> Top = 67, ;
> Left = 9, ;
> Height = 27, ;
> Width = 30, ;
> Caption = "|<<", ;
> Name = "Command7"
>
>
> ADD OBJECT command8 AS commandbutton WITH ;
> Top = 67, ;
> Left = 103, ;
> Height = 27, ;
> Width = 30, ;
> Caption = ">>|", ;
> Name = "Command8"
>
>
> ADD OBJECT command9 AS commandbutton WITH ;
> Top = 106, ;
> Left = 185, ;
> Height = 27, ;
> Width = 84, ;
> Caption = "Save it.", ;
> Name = "Command9"
>
>
> ADD OBJECT label1 AS label WITH ;
> AutoSize = .T., ;
> Caption = "Label1", ;
> Height = 17, ;
> Left = 189, ;
> Top = 14, ;
> Width = 40, ;
> Name = "Label1"
>
>
> PROCEDURE Activate
> this.refresh()
> ENDPROC
>
>
> PROCEDURE Load
> SET EXCLUSIVE OFF
> IF FILE('daysofweek.dbf')
> USE daysofweek SHARED
> ELSE
> CREATE TABLE DaysOfWeek( nID N (8), cDayOfWeek C (9) )
> INSERT INTO DaysOfWeek(nID, cDayOfWeek) VALUES ( SECONDS()*1000,
>DOW( DATE() ) )
> INSERT INTO DaysOfWeek(nID, cDayOfWeek) VALUES ( SECONDS()*1000 +
>RECNO(), CDOW( DATE() + RECNO() ) )
> INSERT INTO DaysOfWeek(nID, cDayOfWeek) VALUES ( SECONDS()*1000 +
>RECNO(), CDOW( DATE() + RECNO() ) )
> INSERT INTO DaysOfWeek(nID, cDayOfWeek) VALUES ( SECONDS()*1000 +
>RECNO(), CDOW( DATE() + RECNO() ) )
> INSERT INTO DaysOfWeek(nID, cDayOfWeek) VALUES ( SECONDS()*1000 +
>RECNO(), CDOW( DATE() + RECNO() ) )
> INSERT INTO DaysOfWeek(nID, cDayOfWeek) VALUES ( SECONDS()*1000 +
>RECNO(), CDOW( DATE() + RECNO() ) )
> INSERT INTO DaysOfWeek(nID, cDayOfWeek) VALUES ( SECONDS()*1000 +
>RECNO(), CDOW( DATE() + RECNO() ) )
> ENDIF
> SET MULTILOCKS ON
> CURSORSETPROP('BUFFERING', 5, 'DAYSOFWEEK')
> ENDPROC
>
>
> PROCEDURE command1.Click
> thisform.refresh()
> ENDPROC
>
>
> PROCEDURE command3.Click
> APPEND BLANK IN DaysOfWeek
> thisform.refresh
> ENDPROC
>
>
> PROCEDURE command4.Click
> SKIP -1 IN DaysOfWeek
> IF BOF('DaysOfWeek')
> GO TOP IN DaysOfWeek
> ENDIF
> THISFORM.REFRESH()
> ENDPROC
>
>
> PROCEDURE command5.Click
> SKIP 1 IN DaysOfWeek
> IF EOF('DaysOfWeek')
> GO BOTTOM IN DaysOfWeek
> ENDIF
> THISFORM.REFRESH()
> ENDPROC
>
>
> PROCEDURE command6.Click
> do form temp.scx
> ENDPROC
>
>
> PROCEDURE command7.Click
> GO TOP IN DaysOfWeek
> THISFORM.REFRESH()
> ENDPROC
>
>
> PROCEDURE command8.Click
> GO BOTTOM IN DaysOfWeek
> THISFORM.REFRESH()
> ENDPROC
>
>
> PROCEDURE command9.Click
> IF .NOT. TABLEUPDATE( 2, .T., 'DaysOfWeek' )
> TABLEUPDATE( .T., 'DaysOfWeek' )
> ENDIF
> ENDPROC
>
>
> PROCEDURE label1.Init
> this.caption = "SET REFRESH = " + STR( SET( 'REFRESH'), 5 )
> ENDPROC
>
>
>ENDDEFINE
>*
>*-- EndDefine: form1
>**************************************************
>
>*!* End code
>
>

Nancy Folsom \(MS FoxPro MVP\)
03-22-2000, 11:29 AM
"Donna Lioy" <dlioy@funcentersoftware.com> wrote in message
news:38d8c584$1@news.devx.com...
>
> Thanks I will try this.

Let us know how it goes and what you find, okay? Good luck.