10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

How You Can Ensure Compatibility Between the Assistant and ApplyTemplateFirst, the parameters are defined:Procedure Create_Dyn_Fld(fs = FrameSource not null,return_code = integer not null,batch_mode = integer not null)=Because the procedure must support batch mode, a default string is specified.Otherwise, the user is prompted for the string:if batch_mode = TRUE thentext_string.value = 'Hello, world!';elsestatus = curprocedure.replypopup(messagetext ='Enter text string.',reply = text_string);if status != PU_OK thenreturn_code = ER_FAIL;return;endif;endif;Next, a text trim field is created and loaded with the specified text string:trim_field = freetrim.create();trim_field.textvalue = text_string.value;Finally, the procedure must assign a value to the return code parameter andattach the composite field to the form. Because the trim field must be assignedto the frame template's top composite field, a recursive search procedure iscalled to search for a composite field with the name FreetrimComposite. Whenit is found, the trim field is added to that composite:topcomposite = callprocfind_top_composite(fs.topform);trim_field.ParentField = topcomposite;return_code = ER_OK;How You Can Attach the Assistant to a Frame TemplateIn the same application that contains the Create_Dyn_Fld frame assistantprocedure, a frame template can be created (for example,My_Frame_Template). To associate the frame template My_Frame_Templatewith its assistant, open the Property Inspector for the frame template in itseditor, and specify Create_Dyn_Fld as the assistant procedure.When a user frame created from the My_Frame_Template frame template isrun through the ApplyTemplate utility, any modifications made to the frameoutside of the composite field defined by the $_TopComposite macro variableis unaffected.Writing a Template Assistant 429

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!