Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

data from a grid to a cursor is not updated

Status
Not open for further replies.

fanlinux90

Programmer
Oct 31, 2022
22
0
0
CO
in the init of the form I have the following code

if !used ("supplier_temp")

SELECT supplier

afields(structure)

CREATE cursor supplier_temp from array structure

else

SELECT supplier_temp
delete all

endif

SELECT provider_temp

APPEND FROM supplier for dispatched = 1

GO TOP


Thisform.Suppliers.RecordSource = "supplier_temp"


Thisform.Suppliers.column1.ControlSource = "supplier_temp.name"

Thisform.Proveedores.column2.ControlSource = "supplier_temp.direntre"

Thisform.Proveedores.column3.ControlSource = "provider_temp.cellphon"

Thisform.Suppliers.column4.ControlSource = "supplier_temp.email"

Thisform.Suppliers.refresh
thisform.refresh

when I modify a data in the grid and close the form the change is not saved in the cursor the new updated data
 
Did you just made a change in one cell to check this?
This will only get saved when you leave the cell. So, edit some cell, leave it then look into the cursor.

Chriss
 
I pointed this out at least two times recently. And that also is the same with just a textbox. The focused control value change is only saved back to the controlsource, if you leave the control. If you would like any keysroke to chenge the cursor or dbf or whatever is the controlsource of a control - any control - then you would need to program a REPLACE in the interactivechange event. But simply go with how VFP works, the active change in the active control is just that, a change of the control. If you would safe any keystroke, then happy worrying about network performance. Besides that, if you read about the VALID event it should be clear how this is guarding the actual controlsource from premature changes that are INvalid.

Do you know what it takes as net load on the network to change one field? It will not matter whether you change one letter only or the whole field. It costs several network packages and quite a few roundtrips. VFP saves this flurry of network activity and only makes changes when the valid event of a control allows that. Buffering reduces that until you actually do TABLEUPDATE() - and that also applies to cursors, if they are buffered.

Even if you don't know nothing about the network aspect of the changes of files and buffering and anything else. It is cleaar as mud that this event has to happen, and it happens just before you switch focus to the next control.

Chriss
 
Oh, and if you expect the supplier.dbf to change, you have got to learn a lot about how FoxPro works, you're only changing supplier_temp, not supplier.

What do you expect to happen if you copy readme.txt to readme_temp.txt and then edit readme_temp.txt? Do you expect this to change readme.txt?
If you copy data and then modify the copy, you only modify the copy.

Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top