Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Command Buttons
Message
 
À
08/11/1999 15:13:51
Jimmy Ditta
Twin City Electronics
Monroe, Louisiane, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Divers
Thread ID:
00288621
Message ID:
00288648
Vues:
12
To start, have you buttons call a form event. This way you can a initiate the "save", "cancel" or "exit" from a command button, a menu option, programmtically, a toolbar...

You save button could simply have this in its click event.

THISFORM.savedata()

Same for the other buttons.

The code in the form (or in the class definition) will depend on how you want to implement these. Some suggestions

* example save method code

* determines if any data has changed and then asks user what to do
IF "2" $ GETFLDSTATE(-1,thisform.dataenvironment.cursor1.alias) OR "4" $ GETFLDSTATE(-1,thisform.dataenvironment.cursor1.alias)
	lnAnswer=MESSAGEBOX("Save changes?",36,"Information has changed")
	IF lnAnswer = 6
		=TABLEUPDATE(0,.T.,thisform.dataenvironment.cursor1.alias)
	ELSE
		=TABLEREVERT(.T.,thisform.dataenvironment.cursor1.alias)
	ENDIF
ENDIF
* example cancel method code
=TABLEREVERT(.T.,thisform.dataenvironment.cursor1.alias)
IF EOF()
  GO BOTTOM
ELSE
  GO RECNO()
ENDIF
THISFORM.REFRESH

* example destroy method code

<pre>
THISFORM.savedata
>Well, i'm really just trying to implement the basic click event code for each button. i'm saving directly to a table. (i'll save the eccentric database tricks for after i'm a little more experienced)

>is the click event code all i need, and what problems might i encounter running a database this way?

>>>are there any good suggestions out there for a newbie trying to put save, cancel and exit buttons on a form?
>>
>>Which aspect are you having trouble with?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform