Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Zul Rahim
  Where is Zul Rahim?
 Houston
 Texas - United States
 Zul Rahim
 To: prasanna kunder
  Where is prasanna kunder?
 mumbai
 India
 prasanna kunder
 Tags
Subject: RE: how prevent accident key press
Thread ID: 331357 Message ID: 331366 # Views: 45 # Ratings: 1
Version: Visual FoxPro 9 Category: Forms
Date: Thursday, December 29, 2011 11:06:00 AM         
   


> hello experts
>
> check this image
>
>
>
>
> how we can prevent accidentally press any button
>
> eg. when user entering data entry, in the middle of data entry by mistakenly user press TOP Button
>
> whatever he typed data entry, he lost
>
> any logic to prevent , that type of mistake
>
> pl.advice
>
> prasanna


Looks like you are looking for a heads down data entry approach. If you have table buffering, all you need is an abstract method in the base form that controls the navigation aspect of the form - something like this:

*-- Possible values for tcNavigation are [P]revious and [N]ext
LPARAMETERS tcNavigation

LOCAL llReturn as Logical, lnAns as Number

tcNavigation = IIF(PCOUNT() = 0, 'P', tcNavigation)
llReturn     = .T.


WITH Thisform

	DO CASE 
		*-- If fieldrule is violated, do not allow the navigation
		CASE .lFieldRuleFailed
			.lFieldRuleFailed = .F.
			llReturn	  = .F.

		*-- If we're deleting a record, allow the navigation
		CASE .lDeleting
			llReturn = .T.

		*-- If new and empty, just discard the record and return .T.
		CASE .NewAndEmpty()
			llReturn = IIF(tcNavigation = 'N', .F., .T.)
			IF llReturn
				.doRevert()
			ENDIF
		
		*-- If changes were made, ask to save 'em.
		CASE .DetectChanges()
			lnAns = MESSAGEBOX(QMSG_EDIT, 3+32, QPROJECTNAME)
			DO CASE
				CASE lnAns = QIDNO
					.DoRevert()
					llReturn = .T.
				CASE lnAns = QIDYES
					llReturn   = .DoSave(.T.)
					.lEditMode = llReturn
				OTHERWISE
					llReturn = .F.
			ENDCASE 
	ENDCASE
	
ENDWITH

RETURN llReturn
		


Zul Rahim
VIVA LA FOX

ENTIRE THREAD

how prevent accident key press Posted by prasanna kunder @ 12/29/2011 8:32:41 AM
RE: how prevent accident key press Posted by Jun Tangunan @ 12/29/2011 8:37:43 AM
RE: how prevent accident key press Posted by prasanna kunder @ 12/29/2011 8:39:59 AM
RE: how prevent accident key press Posted by Jun Tangunan @ 12/29/2011 8:49:37 AM
RE: how prevent accident key press Posted by prasanna kunder @ 12/29/2011 9:04:46 AM
RE: how prevent accident key press Posted by Stefan Wuebbe @ 12/29/2011 9:16:46 AM
RE: how prevent accident key press Posted by prasanna kunder @ 12/29/2011 10:05:06 AM
RE: how prevent accident key press Posted by Zul Rahim @ 12/29/2011 11:06:00 AM
RE: how prevent accident key press Posted by Muhammad Majid Ali Attari @ 12/30/2011 6:29:04 AM
RE: how prevent accident key press Posted by prasanna kunder @ 12/30/2011 8:48:51 AM
RE: how prevent accident key press Posted by Jun Tangunan @ 12/30/2011 7:17:14 AM
RE: how prevent accident key press Posted by prasanna kunder @ 12/30/2011 8:48:14 AM