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 DynamicallyThe variable numcolumns, initialized to zero before the select, controls theexecution of this code. If numcolumns is non-positive, the columnnamevariable represents the first row returned by the select statement and the Gooperation executes the code that builds the initial portions of the SQLstatements. The numcolumns variable is incremented with each pass throughthe loop so that subsequent values of the columnname variable are added toan existing string.The variables that hold the character strings representing the SQL statementsare of the data type varchar(2000). The system constants HC_NEWLINE andHC_TAB represent newline and tab characters, respectively. If your statementstrings are longer than 2000 characters, it is preferable to use StringObjectvariables instead of varchar variables.After adding the column name to the statement strings, the Go operationconstructs the field title and the field itself (all of which are entry fields in theexample). The following code creates the field title and attaches it to the form:trim_ptr = FreeTrim.Create();trim_ptr.XLeft = trimleft;trim_ptr.YTop = fieldtop;trim_ptr.TextValue = trim(trim(uppercase(left(columnname,1))) +trim(lowercase(shift(columnname,-1))) + ':');trim_ptr.IsBold = TRUE;trim_ptr.TypeSize = 10;trim_ptr.Width = 33 * widthchar;trim_ptr.Height = heightchar;trim_ptr.ParentField = test_frame.TopForm;Each field's title is an object of the class FreeTrim, which is used only fortextual trim on forms. The previous code defines the trim's position on theform (XLeft and YTop), its actual text value (TextValue), and the appearanceof the text (IsBold, TypeSize, Width, and Height).The code also uses SQL string functions (uppercase and lowercase) to ensurethat the title appears with initial capitalization.Specifying a ParentField attribute for an object identifies which composite fieldcontains that object. Therefore, assigning the form object intest_frame.TopForm to the ParentField attribute of the FreeTrim objectattaches the trim to the form by identifying the form as the composite fieldthat contains the trim.Creating a Frame at Runtime 407

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

Saved successfully!

Ooh no, something went wrong!