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 Build a Frame DynamicallyThe following code from the example frame sets each entry field's attributesand attaches it to the form:/* Now place it on the form. */field_ptr.Width = columnlength * widthchar;field_ptr.Height = heightchar * fieldheight;field_ptr.OutlineWidth = LW_VERYTHIN;/* attach to form */field_ptr.ParentField = test_frame.TopForm;fieldtop = fieldtop + field_ptr.Height +vertspace;end; /* End of select loop */commit;After attaching the field to the form, the previous code assigns a new value tothe fieldtop variable, which determines the position of the next field. The valuein the fieldtop variable was assigned to the YTop attribute when the entry fieldwas constructed. For discussions on setting the fieldtop variable, see How YouCan Create the FrameSource Object (see page 403).The statement in the previous code that sets the fieldtop variable takes thecurrent value of fieldtop and adds to it the height of the field just constructedand a predetermined amount of vertical space. The resulting figure is the valueof fieldtop for the next iteration of the loop and places the next field on theform below the field just constructed. The amount of space between them isequal to the amount specified by the vertspace variable.The select loop is repeated once for each column name returned by the selectstatement. When it is finished, all fields have been constructed and placed onthe form. In addition, portions of the SQL statements used in the generatedframe's script are also constructed.How You Can Set the Form Height and WidthAfter all the fields have been constructed, you can set the dimensions of thewindow displaying the frame by setting the WindowHeight and WindowWidthattributes of the FrameSource object. The following code from the Gooperation of the DynamicFrame frame sets these dimensions:/* Now set the form height and width */test_frame.WindowHeight = fieldtop + vertspace;test_frame.WindowWidth = maxformwidth;if test_frame.WindowHeight > maxformheight thentest_frame.WindowHeight = maxformheight;test_frame.HasScrollbars = TRUE;elsetest_frame.HasScrollbars = FALSE;endif;410 <strong>Programming</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!