Date: Fri, 16 Dec 2005 16:25:09 -0500
Reply-To: "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Subject: Re: SAS/AF: Validate Text Entry Control after user leaves field
Peter Mroz wrote:
> Hi SAS-L experts,
> I have a text entry control in a SAS/AF frame, and I want to run some
> code to validate the text when the user leaves this text entry
> control. In my Frame SCL I have a section labeled with the name of
> the text entry control, but it does not appear to execute properly.
> Do I have to change the onValueChanged method of this field instead?
In SAS/AF you can skin the proverbial cat in many ways.
When frame SCL programmatically changes a controls value then controls
object label does not run.
Solution 1: Override a control method.
This requires a secondary SCL entry "myFrameMethods.scl" which contain your
per instance override implementations.
Solution 2: Explicitly invoke object label.
Either link to the label, or invoke the controls _objectLabel() to force the
AF event handling executor to direct program flow through the label
Consider a frame with a text entry and button.
put 'frame scl text entry handler for user interactively initiated events
(keypresses and control losing focus)';
put 'frame scl button click handler';
textentry1.text = 'PROGRAM SET THIS';
* link textentry1;
If you type in something and click on the button what happens?
- text entry handler runs
- button handler run
-- changes the text entry
-- text entry does _not_ run again because of programmatic change
For one-offs, link or objectLabel() are probably fine.
For those with OO design consciences, per instance method override is
If you find yourself implementing the same override multiple times in same
or multiple frames, then you should likely create a subclass in which the
override is the normal behaviour.
For firebrand evangelists of extreme object persuasion, nothing short of a
subclass instance is appropriate in all cases.
Richard A. DeVenezia