Search This Blog

Showing posts with label close. Show all posts
Showing posts with label close. Show all posts

Changing Image or Picture of a Button

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

Cancel Close Code



If you want your button's picture to change when your Close/Cancel button also changed.

IF THIS.Picture = "c:\SalesMarket\Images\close.jpg"
THISFORM.Release()
ELSE
THIS.Picture = "c:\SalesMarket\Images\close.jpg"
THISFORM.ReadOnlyTrue()
THISFORM.Combo1.Enabled = .F.
THISFORM.cmdPrint.Enabled = .T.
THISFORM.cmdEdit.Enabled = .T.
THISFORM.cmdEdit.Picture = "c:\SalesMarket\Images\edit.jpg"
ENDIF

Close or Exit Code

Sometimes when you tried to exit or close the program but unsuccessfully close. Try below codes. This is due to the READ EVENTS that sre still running so you need to CLEAR EVENTS then QUIT.

CLEAR EVENTS
QUIT