Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Returning Controls to Original Properties

I wanted to see if anyone out there had some suggestions for a common process that I have to deal with regularly. Often there are processes in forms in which the user's interaction invokes changes to properties on controls in the form (i.e. READONLY). When the WRITE, CLEAR, or DELETE event is invoked on the window, the form ends up cleared, but the controls on the form do not go back to their original state. I have handled this typically by having some cleanup code that goes through each control, setting the changed properties back to their original values, but I find it a little cumbersome. I've also had mixed results with the use of the ORIG_XXX property in this clean up code. Is there perhaps some easier and more effective method that some of you use to accomplish this task?

Comments

  • I wish there was a clever way for this. I typically just use cleanup code as you have done. One idea, which I haven't tried, would involve Promoted Events. Perhaps you could flag control A, B, and C during the CREATE event of the form to have certain properties cached. Then, the promoted CREATE event does the work of caching those property values, and the promoted CLEAR event resets them. In theory, then you would only do something like this during the CREATE event:

    // Flag these controls to cache their SIZE and ENABLED properties // so they can be reset during CLEAR SetAutoReset(@Window:".CONTROL_A", "SIZE,ENABLED") SetAutoReset(@Window:".CONTROL_B", "SIZE,ENABLED") SetAutoReset(@Window:".CONTROL_C", "SIZE,ENABLED")
  • Thanks Kevin!
Sign In or Register to comment.