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 You Can Add the Frame to the ApplicationAfter the frame has been fully defined, it must be attached to the applicationby setting the ParentApplication attribute of the new frame's FrameSourceobject to the same value that is in the ParentApplication attribute of thecurrently executing frame. (The currently executing frame is the starting frameof the dynamic application.)The following code from the example application sets the ParentApplicationattribute of the generated frame:test_frame.ParentApplication =CurFrame.ObjectSource.ParentApplication;This statement assigns the contents of the ParentApplication attribute of thecurrent frame's FrameSource object to the corresponding attribute of thegenerated frame's FrameSource object. For a more detailed explanation of thepreceding syntax, see How You Can Attach the Frame to the Application (seepage 396).The DynamicFrame frame performs the additional step of adding the frame toa list of already generated frames. Because the sample application lets a userreturn to the initial frame, select another table, and select the Go menu itemagain, a global array variable is used to keep track of which frames havealready been generated.Because the Generated_Frame_List global variable stores the names ofgenerated frames, an existing frame can be executed without requiringregeneration if the user selects a table for which a frame already exists.The following code from the example application adds the newly generatedframe to the list in the global array variable:i = Generated_Frame_List.LastRow + 1;Generated_Frame_List[i].table_name = table_choices;Generated_Frame_List[i].frame_name = table_choices +'_frame';Generated_Frame_List[i].frame_source = test_frame;The global array variable, Generated_Frame_List, has three attributes:table_name, frame_name, and frame_source. The previous code uses theLastRow attribute (defined for the ArrayObject class) to determine the rowsequence number of the last row in the array. The current value of theLastRow attribute is incremented by one to create a new index into the array.416 <strong>Programming</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!