You can definitely change the picture of your bitton upon clicking, try these codes and play with the images. But first you have to prepare the image in JPEG.
IF THIS.Picture = "c:\images\edit.jpg"
THIS.Picture = "c:\images\save.jpg"
THISFORM.cmdClose.Picture = "c:\images\cancel.jpg"
ELSE
IF THISFORM.Combo1.Value = 'PESO'
lAnswer = MESSAGEBOX("Save changes?", 4, "Confirmation")
IF lAnswer = 6
THISFORM.cmdClose.Picture = "c:\images\close.jpg"
THISFORM.cmdEdit.Picture = "c:\images\edit.jpg"
ENDIF
ELSE THISFORM.COMBO1.Value = 'DOLLAR'
lAnswer = MESSAGEBOX("Save changes?", 4, "Confirmation")
IF lAnswer = 6
THISFORM.cmdClose.Picture = "c:\images\close.jpg"
THISFORM.cmdEdit.Picture = "c:\images\edit.jpg"
ENDIF
ENDIF
ENDIF
Search This Blog
Showing posts with label edit. Show all posts
Showing posts with label edit. Show all posts
Empty Box
This code lets you use an Edit Box and will saved "Y" if the edit box is not empty otherwise save "N" if the edit box is blank. This is useful if you need to show in a View what Edit Box has an input and will not include blank.
SELECT QuestionTable
REPLACE q1comment WITH THISFORM.EDIT1.Value
IF EMPTY(THISFORM.EDIT1.Value)
REPLACE Q1Indicator WITH "N"
ELSE
REPLACE Q1Indicator WITH "Y"
ENDIF
SELECT QuestionTable
REPLACE q1comment WITH THISFORM.EDIT1.Value
IF EMPTY(THISFORM.EDIT1.Value)
REPLACE Q1Indicator WITH "N"
ELSE
REPLACE Q1Indicator WITH "Y"
ENDIF
Edit Save Code
Microsoft Visual FoxPro programming language has a lot of code to edit, insert, replace or save. Using select, append, insert or replace is some of the ways to save data. I always use the select and replace because it is easy to troubleshoot when your code has a problem.
SELECT InfoNumber
LOCATE FOR IdNum = THISFORM.txtIdNum.VALUE
IF FOUND()
SELECT InfoNumber
REPLACE LastName WITH ALLTRIM(THISFORM.txtLastName.VALUE)
REPLACE FirstName WITH ALLTRIM(THISFORM.txtFirstName.VALUE)
REPLACE MiddleName WITH ALLTRIM(THISFORM.txtMiddleName.VALUE)
Edit Save Code
Most of the time neophyte VFP Programmers know how to add, edit and save data on the table. But how can we improve the form design? This is a sample I usually used, to ask or confirm if the User want to edit dat. A confirmation message box will appear with a 'Yes' or 'No'. From that the User can choose which will be the next function.
lAnswer = MESSAGEBOX("Save and update Counter Dispatch?", 4, "Confirmation")
IF lAnswer = 6
SELECT sviewbranch
LOCATE FOR IdNum = THISFORM.Text12.Value
IF FOUND()
REPLACE beginbal WITH THISFORM.TEXT1.Value
REPLACE branchname WITH THISFORM.TEXT2.Value
REPLACE branchaddress WITH THISFORM.TEXT3.Value
REPLACE branchdesc WITH THISFORM.TEXT4.Value
REPLACE debit WITH THISFORM.TEXT5.Value
REPLACE credit WITH THISFORM.TEXT6.Value
REPLACE netchange WITH THISFORM.TEXT7.Value
REPLACE ending WITH THISFORM.TEXT8.Value
REPLACE branchdescnum WITH THISFORM.TEXT9.Value
THISFORM.REFRESH
ENDIF
Subscribe to:
Posts (Atom)