LOCAL llAppExists, ; llReturnValue *-- Define local variables llAppExists = ( TYPE( "oApp" ) = "O" AND !ISNULL( oApp ) ) *-- Perform the default behavior llReturnValue = DODEFAULT() *-- If the default behavior was successful, *-- assign the desired properties IF llReturnValue *-- If we have an app object, read the value from the configuration DBF THIS.icPictureFilePath = IIF( EMPTY( THIS.icPictureFilePath ) AND llAppExists, ; oApp.GetAppInfo( "CommandButtonPictureFilePath" ), ; THIS.icPictureFilePath ; ) *-- If the picture file path is null, *-- store an empty string so we don't get errors IF ISNULL( THIS.icPictureFilePath ) THIS.icPictureFilePath = SPACE( 0 ) ENDIF && ISNULL( THIS.icPictureFilePath ) *-- Populate the CommandButton controls *-- with the desired pictures THIS.PopulateCommandButtonPictures() ENDIF && llReturnValue *-- Clean up and return RETURN ( llReturnValue )The PopulateCommandButtonPictures() code looks like this:
LOCAL lcPictureFilePath, ; loControl *-- Define local variables lcPictureFilePath = THIS.icPictureFilePath loControl = .NULL. *-- If we have a file path, *-- add a backslash to the end lcPictureFilePath = IIF( !EMPTY( lcPictureFilePath ), ; ADDBS( lcPictureFilePath ), ; lcPictureFilePath ; ) *-- Loop through the contained controls FOR EACH loControl IN THIS.Controls *-- If the control has the icPictureFileName property, *-- assign the Picture property of the control IF PEMSTATUS( loControl, "icPictureFileName", 5 ) loControl.Picture = lcPictureFilePath + loControl.icPictureFileName ENDIF && PEMSTATUS( loControl, "icPictureFileName", 5 ) ENDFOR && EACH loControl IN THIS.ControlsYou could apply this same concept to menus by placing this code in a separate logic class and firing the necessary methods in the Skip For prompt option of each menu bar.