LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2005, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 16 Dec 2005 18:55:15 -0500
Reply-To:     Randy Herbison <RandyHerbison@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Randy Herbison <RandyHerbison@WESTAT.COM>
Subject:      Re: SAS/AF: Validate Text Entry Control after user leaves field
Comments: To: Peter Mroz <zstringer999@gmail.com>
Content-Type: text/plain; charset="us-ascii"

Peter,

If I understand the problem correctly, you would like the text entry control's object label to run each time a user leaves the control.

The control's object label will run if its value is modified and the user clicks on the frame, another control, or presses the Enter key.

If you override the onValueChanged method, I think you'll need to set the text entry control's keyFeedback attribute to Yes to get the method to run. The problem with this approach is that the onValueChanged method will run each time any character is entered, deleted, or replaced.

RandyHerbison@westat.com

-----Original Message----- From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu] On Behalf Of Peter Mroz Sent: Friday, December 16, 2005 3:33 PM To: sas-l@uga.edu Subject: SAS/AF: Validate Text Entry Control after user leaves field

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?

The text field in question holds the full path to a SAS dataset. For example:

C:\CRFs\ABC9918\abc.sas7bdat

I've placed a Browse button next to the field so that users can locate the file using a familiar windows file open dialog box. However, they can also enter the filename by simply typing it into the field. I want to validate the file using fileexist just after they leave the field.

Here's a snippet of SCL from my frame SCL. The browse button is called get_clintrial_pd_file, and the text field is called clintrial_pd_file. Note that if they select a file using the browse button the callback function also links to the text entry validation routine.

/*---------------------------------------------------------------------- --------------*/ /* Full path to Clintrial PD dataset */ get_clintrial_pd_file:

rc = filedialog('OPEN', ctfile, '', '', '*.sas7bdat'); if (ctfile ne '') then do; clintrial_pd_file.text = ctfile; run_button.enabled = 'Yes'; end; else run_button.enabled = 'No';

/* Call the section that validates the CT file */ link clintrial_pd_file;

return;

/*---------------------------------------------------------------------- --------------*/ /* Process the Clintrial PD File */ clintrial_pd_file:

if (clintrial_pd_file.text ne '') then do; if (fileexist(clintrial_pd_file.text)) then do;

/* What this code does is figure out where the last dot and backslash are, and then extract the libname directory and dataset from the filespec */ str_length = length(clintrial_pd_file.text); ctfile = reverse(clintrial_pd_file.text); dot_loc = index(ctfile, '.'); bslash_loc = index(ctfile, '\'); ctpd_lib = substr(clintrial_pd_file.text, 1, (str_length - bslash_loc)); ctpd_dataset = substr(clintrial_pd_file.text, (str_length - bslash_loc + 2), (bslash_loc - dot_loc - 1)); end; else do; rc = insertc(error_msg_list, "The file ", 1); rc = insertc(error_msg_list, clintrial_pd_file.text, 2); rc = insertc(error_msg_list, "does not exist", 3); dummy = messagebox(error_msg_list, 'I', 'O'); rc = dellist(error_msg_list); end; end;

return;

Thanks for your help

Peter Mroz ClinForce - Clinical Pharmacology Data Sciences 2200 Renaissance Blvd, Suite 145 King of Prussia, PA 19406 (484) 322-0604 ext. 224


Back to: Top of message | Previous page | Main SAS-L page