Information générale
Catégorie:
Gestionnaire d'écran & Écrans
This is kinda cool. I guess I should stop using the old FPW 2.6 if I am now in this new VFP 6.o environment.
Let me get this straight. I did what I thought you meant, and it seems to work, but since I do not know what I am doing I wanted to run this by you.
In the forms property window, I changed to "BufferMode" to "1 = Pessimestic".
The code in my "Add" button is as follows:
m.currec=recno()
m.isadding=.T.
m.isediting=.F.
thisform.TopButton.Enabled=.F.
thisform.PriorButton.Enabled=.F.
thisform.NextButton.Enabled=.F.
thisform.EndButton.Enabled=.F.
thisform.FindButton.Enabled=.F.
thisform.PrintButton.Enabled=.F.
thisform.AddButton.Enabled=.F.
thisform.EditButton.Enabled=.F.
thisform.SaveButton.Enabled=.T.
thisform.CancelButton.Enabled=.T.
thisform.ExitButton.Enabled=.F.
thisform.txtName.Enabled=.T.
thisform.txtCompany.Enabled=.T.
thisform.txtAddress1.Enabled=.T.
thisform.txtAddress2.Enabled=.T.
thisform.txtCity.Enabled=.T.
thisform.txtSt.Enabled=.T.
thisform.txtZip.Enabled=.T.
thisform.txtPhone.Enabled=.T.
thisform.txtFax.Enabled=.T.
thisform.txtEmail.Enabled=.T.
thisform.txtNotes.Enabled=.T.
APPEND blank
GO bottom
thisform.txtName.SetFocus
thisform.Refresh
The code in my "Edit" button is as follows:
m.currec=recno()
m.isadding=.F.
m.isediting=.T.
thisform.TopButton.Enabled=.F.
thisform.PriorButton.Enabled=.F.
thisform.NextButton.Enabled=.F.
thisform.EndButton.Enabled=.F.
thisform.FindButton.Enabled=.F.
thisform.PrintButton.Enabled=.F.
thisform.AddButton.Enabled=.F.
thisform.EditButton.Enabled=.F.
thisform.SaveButton.Enabled=.T.
thisform.CancelButton.Enabled=.T.
thisform.ExitButton.Enabled=.F.
thisform.txtName.Enabled=.T.
thisform.txtCompany.Enabled=.T.
thisform.txtAddress1.Enabled=.T.
thisform.txtAddress2.Enabled=.T.
thisform.txtCity.Enabled=.T.
thisform.txtSt.Enabled=.T.
thisform.txtZip.Enabled=.T.
thisform.txtPhone.Enabled=.T.
thisform.txtFax.Enabled=.T.
thisform.txtEmail.Enabled=.T.
thisform.txtNotes.Enabled=.T.
thisform.txtName.SetFocus
thisform.Refresh
The code in my "Cancel" button is as follows:
IF m.isadding=.T.
m.isediting=.F.
m.isadding=.F.
GO bottom
Delete next 1
GOTO m.currec
ENDIF
IF m.isediting=.T.
TABLEREVERT()
m.isediting=.F.
m.isadding=.F.
ENDIF
thisform.TopButton.Enabled=.T.
thisform.PriorButton.Enabled=.T.
thisform.NextButton.Enabled=.T.
thisform.EndButton.Enabled=.T.
thisform.FindButton.Enabled=.T.
thisform.PrintButton.Enabled=.T.
thisform.AddButton.Enabled=.T.
thisform.EditButton.Enabled=.T.
thisform.SaveButton.Enabled=.F.
thisform.CancelButton.Enabled=.F.
thisform.ExitButton.Enabled=.T.
thisform.txtName.Enabled=.F.
thisform.txtCompany.Enabled=.F.
thisform.txtAddress1.Enabled=.F.
thisform.txtAddress2.Enabled=.F.
thisform.txtCity.Enabled=.F.
thisform.txtSt.Enabled=.F.
thisform.txtZip.Enabled=.F.
thisform.txtPhone.Enabled=.F.
thisform.txtFax.Enabled=.F.
thisform.txtEmail.Enabled=.F.
thisform.txtNotes.Enabled=.F.
thisform.Refresh
The code in my "Save " button is as follows:
IF m.isadding=.T.
m.isediting=.F.
m.isadding=.F.
ENDIF
IF m.isediting=.T.
TABLEUPDATE()
m.isediting=.F.
m.isadding=.F.
ENDIF
thisform.TopButton.Enabled=.T.
thisform.PriorButton.Enabled=.T.
thisform.NextButton.Enabled=.T.
thisform.EndButton.Enabled=.T.
thisform.FindButton.Enabled=.T.
thisform.PrintButton.Enabled=.T.
thisform.AddButton.Enabled=.T.
thisform.EditButton.Enabled=.T.
thisform.SaveButton.Enabled=.F.
thisform.CancelButton.Enabled=.F.
thisform.ExitButton.Enabled=.T.
thisform.txtName.Enabled=.F.
thisform.txtCompany.Enabled=.F.
thisform.txtAddress1.Enabled=.F.
thisform.txtAddress2.Enabled=.F.
thisform.txtCity.Enabled=.F.
thisform.txtSt.Enabled=.F.
thisform.txtZip.Enabled=.F.
thisform.txtPhone.Enabled=.F.
thisform.txtFax.Enabled=.F.
thisform.txtEmail.Enabled=.F.
thisform.txtNotes.Enabled=.F.
thisform.Refresh
Is this correct?
Do I need to understand what is happening?
Is there also an easier way to do all of this Enabling and Disabling?
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement