10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

How You Can Write an AssistantBecause 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, the text field with the variable name "label" is loaded with the specifiedtext string:field_obj = CompositeField(ff).FieldByName(name ='label');EntryField(field_obj).textvalue = text_string.value;Finally, the procedure needs to assign a value to the return code parameter:return_code = ER_OK;How You Can Attach the Assistant to a Field TemplateIn the same application that contains the frame assistant procedureCreate_Label, a field template can be created (called, for example,My_Field_Template). This template should contain one composite field thatconsists of several entry fields, and one free trim field for the label with thevariable name of “label.” To associate the field template My_Field_Templatewith its assistant, open the Property Inspector for the field template in itseditor, and specify Create_Label as the assistant procedure.When a form field is subsequently created from the templateMy_Field_Template, the procedure Create_Label is called, which populates thenew label with the text string entered by the user.The full text of the field assistant procedure is as follows:Procedure Create_Label(ff = FormField not null,return_code = integer not null,batch_mode = integer not null) =declaretext_string = StringObject;status = integer not NULL;enddeclare424 <strong>Programming</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!