Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Wizard form
Message
 
To
25/02/2006 06:56:55
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Environment versions
Visual FoxPro:
VFP 9
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01098903
Message ID:
01099167
Views:
13
I would suggest using seek() rather than locate() to find the records. Just add an index to your table on that field. Also put controlsources in your texboxes so you donèt have to fill them once you found your record. If this is ever going to be a multiuser environment, you will encounter a problem with the pack command, as it requires exclusive access. Just use SET DELETED ON in the load of your form, and just use delete on the record to be deleted, it will disappear, if you refresh the form.

>thank you for information and advice,
>
>i need to do that, becuse i want to create form have 5 commands buttons as add,edit,delete,query and report as wizard form,
>
>i do all operations before, but every command via spical form.
>
>i try as under but still i need a time to do it via correct way,
>if you have time to see ,help and corect this code
>
>at thisform.text1.value i put this code
>i have only 2 textbox at my form and 5 commands buttos ,
>ACT_FLAG=3 for delete
>ACT_FLAG=1 for add new
>ACT_FLAG=2 for edit
>----------------------------------------------
>ACT_FLAG=4 for query still &&as delete without  delete
>ACT_FLAG=3 for report still && i can do it
>
>
>CLOSE all
>
>USE store IN 0
>*? ACT_FLAG
>*WAIT
>IF ACT_FLAG=3
>     LOCATE FOR STOReID=UPPER(ALLTRIM(THISFORM.TEXT1.VALUE))
>   IF FOUND()
>        THISFORM.TEXT1.VALUE=STOREID
>        THISFORM.TEXT2.VALUE=description
>        DELETE FOR STOReID=UPPER(ALLTRIM(THISFORM.TEXT1.VALUE))
>        pack
>    ELSE
>        =MESSAGEBOX("not found")
>    ENDIF
>
>ENDIF
>*-------
>IF ACT_FLAG=1
>        LOCATE FOR STOReID=UPPER(ALLTRIM(THISFORM.TEXT1.VALUE))
>   IF !FOUND()
>       M.STOREID=UPPER(ALLTRIM(THISFORM.TEXT1.VALUE))
>       M.description=THISFORM.TEXT2.VALUE
>       APPEND blank
>       replace storeid WITH M.STOREID,description WITH m.description FOR STOReID=UPPER(ALLTRIM(THISFORM.TEXT1.VALUE))
>   ENDIF
>ENDIF
>*---------
>IF act_flag=2
>*CLOSE all
>*USE store IN 0
>     LOCATE FOR STOReID=UPPER(ALLTRIM(THISFORM.TEXT1.VALUE))
>  IF FOUND()
>      M.STOREID=UPPER(ALLTRIM(THISFORM.TEXT1.VALUE))
>      M.description=THISFORM.TEXT2.VALUE
>          replace storeid WITH M.STOREID,description WITH m.description FOR STOReID=UPPER(ALLTRIM(THISFORM.TEXT1.VALUE))
>          BROWSE
>
>   ELSE
>     =MESSAGEBOX("not found")
>  ENDIF
>ENDIF
>
>
>
>>I would recommand NOT to use the wizard if you need to modiy what the code does. I have been through what you are trying to achieve, the wizard code works if you don't modify it, and if you decide to modify you have to understand the impact it will have on the rest of the wizard code. But if you still want to use this code, I would recommend not to modify the parent class code (which is part of VFP framework), but rather copy the parent class code into you click event, and modify that, this way you will not change the behavior of the parent class.
>>
>>>hi,
>>>thank you for reply,
>>>i put at click event DODEFAULT()
>>>
>>>i see at delete command at view parent code --->txtbtns
>>>this code? how i can add new code or locate to somthing if found it don't delete.
>>>
>>>
>>>#DEFINE C_WIZSTYLE			"WIZBTNS.VCX"
>>>#DEFINE C_WIZDIR 			"WIZARDS\"
>>>#DEFINE C_PROMPT1_LOC		"Find: "
>>>#DEFINE E_NOSTYLE_LOC		"The class library (WIZBTNS.VCX) needed by this form could not be found. "+;
>>>							"Please locate."
>>>
>>>LOCAL cGridRef,cWizHomePath,separator,cWizStyFile
>>>
>>>IF TYPE('THIS.Parent') # "O"
>>>	RETURN
>>>ENDIF
>>>
>>>IF SET("TALK") = "ON"
>>>	SET TALK OFF
>>>	THIS.oldTalk = "ON"
>>>ELSE
>>>	THIS.oldTalk = "OFF"
>>>ENDIF
>>>
>>>
>>>IF ATC(C_WIZSTYLE,SET("CLASSLIB")) = 0
>>>	
>>>	* Returns just the pathname
>>>	cWizHomePath = _WIZARD
>>>	IF '\' $ cWizHomePath
>>>	   cWizHomePath = SUBSTR(m.cWizHomePath,1,RAT('\',m.cWizHomePath))
>>>	   IF RIGHT(m.cWizHomePath,1) = '\' AND LEN(m.cWizHomePath) > 1 ;
>>>	            AND SUBSTR(m.cWizHomePath,LEN(m.cWizHomePath)-1,1) <> ':'
>>>	         cWizHomePath = SUBSTR(m.cWizHomePath,1,LEN(m.cWizHomePath)-1)
>>>	   ENDIF
>>>	ELSE
>>>	   cWizHomePath = ''
>>>	ENDIF
>>>
>>>	* Add a backslash unless there is one already there.
>>>	separator = IIF(_MAC,":","\")
>>>	IF !(RIGHT(m.cWizHomePath,1) $ '\:') AND !EMPTY(m.cWizHomePath)
>>>	   m.cWizHomePath= m.cWizHomePath+ m.separator
>>>	ENDIF
>>>
>>>	DO CASE
>>>	CASE FILE(C_WIZSTYLE)
>>>		cWizFile = C_WIZSTYLE
>>>	CASE FILE(m.cWizHomePath+C_WIZSTYLE)
>>>		cWizFile = m.cWizHomePath+C_WIZSTYLE
>>>	CASE FILE(m.cWizHomePath+C_WIZDIR+C_WIZSTYLE)
>>>		cWizFile = m.cWizHomePath+C_WIZDIR+C_WIZSTYLE	
>>>	CASE FILE(HOME()+C_WIZSTYLE)
>>>		cWizFile = HOME()+C_WIZSTYLE
>>>	CASE FILE(HOME()+C_WIZDIR+C_WIZSTYLE)
>>>		cWizFile = HOME()+C_WIZDIR+C_WIZSTYLE
>>>	OTHERWISE
>>>		=MESSAGEBOX(E_NOSTYLE_LOC)
>>>		cWizFile = GETFILE("VCX",C_PROMPT1_LOC+C_WIZSTYLE)
>>>	ENDCASE
>>>	
>>>	IF ATC(C_WIZSTYLE,m.cWizFile)#0
>>>		SET CLASS TO (m.cWizFile) ADDITIVE
>>>	ELSE
>>>		* Failed to get WIZSTYLE.VCX file
>>>		RETURN .F.
>>>	ENDIF
>>>	
>>>ENDIF
>>>
>>>THIS.InitVars()
>>>
>>>IF THIS.lStartTop AND !EMPTY(ALIAS())
>>>	GO TOP
>>>ENDIF
>>>
>>>THIS.ButtonRefresh()
>>>THIS.NavRefresh()
>>>
>>>cGridRef=THIS.GridRef
>>>IF !EMPTY(m.cGridRef)
>>>	* Change this if you desire to have the grid initially selected.
>>>	* THISFORM.&cGridRef..SetFocus()
>>>ENDIF
>>>
>>>
>>>
>>>>If you still want to have the functionnality of the button and you want to add code after the record is deleted, use something like in the click event of the button.
>>>>
DODEFAULT()
>>>>  &&& New code here
>>>>
>>>>If you want to do something before the record is deleted reverse the order above.
>>>>
>>>>
>>>>>hi all,
>>>>>any idea help
>>>>>how i can add new code at delete command at myform created via wizard form.
>>>>>
>>>>>thanks
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform