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 DynamicallyDynamic database frames are often a useful way to provide a generic frame,that is, a frame that a user can run against any table in the database. Forexample, a library could give patrons the ability to search online tables ofauthors, titles, or subjects. Writing a separate frame for each possible tablewould be inefficient. Much more efficient is writing one general frame to runagainst any table in the library's database.The DynamicFrame frame at runtime displays the starting frame that providesthe user with a choice of database tables. The starting frame then builds asecond frame that presents the columns of the chosen table as simple fields ona form. The second frame contains menu items that let the user update valuesin the current row, delete the row, or request the next row. A sample dynamicapplication illustrates this process.How You Can Build a Frame DynamicallyWhen you build a frame dynamically, you must do in 4GL the tasks that you(or OpenROAD) would do if you were using OpenROAD Workbench to create aframe, which include:• Create a frame and set its attributes• Create the form associated with the frame• Create the fields on the form and set their attributes• Create the frame's menu• Create the frame's scriptThe preceding tasks require you to create several objects, for example, aframe, a form, and a menu. To create an object dynamically, use the Createmethod. Executing the Create method returns an object of the specified class.The syntax of the Create method is:refvariable = Class.Create()refvariableClassSpecifies a return variable that must have been declared as the same classas Class or one of its superclasses. For example, if you want to create anentry field, you must first declare the reference variable that points to theobject:field_ptr = EntryField;Then you can use the following statement to create the actual object:field_ptr = EntryField.Create();Specifies the class of the object that you want to create392 <strong>Programming</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!