Another newbie question: I’m referring to the GSLesson app, created by doing the Getting Started steps in the documentation.
There is no visual difference in the Customer edit form whether I click on “View Customer” or “Edit Customer”. I would like to be able to make the controls flat and disabled when I’m in View Customer mode, and hide the “OK” button. I don’t want users to think they can edit the data when they can’t. It just wastes everyone’s time.
How do I do this so that I don’t interfere with the form when the user clicks on “Edit Customer” ?
Open the window embed (on the update window):
if self.Request = ViewRecord
message(‘view…’)
here you can do things like give the field a color / hide the ok button
End
Use a different form (or even a simple REPORT) for Viewing.
LOOP through all of the controls and set them to readonly and change the background to Color:BtnFace. (SOME control types, including buttons, droplists, and options don’t handle readonly so well, so you might need to DISABLE those types instead. It can be kind of a PITB to make a form read only, especially if there are browses.
It’s pretty simple to call an alternate window. If, instead of the actual FORM procedure, you call a SOURCE procedure from the BROWSE. In that SOURCE procedure, put something like this:
CASE GlobalRequest
OF InsertRecord OROF ChangeRecord OROF DeleteRecord
MyUpdateForm !Call the form
OF ViewRecord
MyViewOnlyForm !Call the view only form
END