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 Build a Frame DynamicallyHow Generating the Frame Source Code WorksPart of the source code for the generated frame was written in the select loopthat constructed the fields. The next section of the DynamicFrame frame scriptcreates the generated frame's source code from the strings constructed in theselect loop.The starting frame uses the following steps to create the generated frame'ssource code:1. Creates the string object to hold the completed script and assigns it to theScript attribute of the FrameSource:test_frame.Script = StringObject.Create();2. Constructs the script, creating an initialize block and event code for fiveClick events that correspond to the five MenuButton objects constructedearlier in the program (Commit, Rollback, Delete, Update, and Next).The example frame uses the ConcatVarchar method (defined for theStringObject class) to concatenate the various pieces of the initializestatement and each event block into one large string. The ConcatVarcharmethod appends the string specified by the text parameter to theStringObject and returns a reference to the original StringObject.The following code constructs the script for the generated frame:/* Set up the initialize block */test_frame.Script.ConcatVarchar(text ='initialize (table_cursor = CursorObject)=' + HC_NEWLINE + HC_TAB + 'begin' +HC_NEWLINE + HC_TAB + HC_TAB + selectstring +HC_NEWLINE);test_frame.Script.ConcatVarchar(text = HC_TAB + HC_TAB +selectupdatestring + HC_NEWLINE + HC_TAB +HC_TAB + 'CurFrame.SendUserEvent(eventname = ''Next'');' +HC_NEWLINE + HC_TAB + 'end;' +HC_NEWLINE + HC_NEWLINE);/* Set up the file.commit script */test_frame.Script.ConcatVarchar(text ='on click file_menu.commit_menu = ' +HC_NEWLINE + HC_TAB +'begin' + HC_NEWLINE +HC_TAB + HC_TAB + 'close table_cursor;' +HC_NEWLINE + HC_TAB + HC_TAB + 'commit work;'+ HC_NEWLINE + HC_TAB + HC_TAB + 'return;' +HC_NEWLINE + HC_TAB + 'end;' +HC_NEWLINE + HC_NEWLINE);414 <strong>Programming</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!