|Navigation: Language Reference > 9 - Window and Report Attributes > Window and Report Attributes >====== FROM (set listbox data source) ======|
|FROM||Specifies the source of the data displayed or printed in a LIST control.|
|source||The label of a QUEUE or field within a QUEUE, or a string constant or variable (normally a GROUP) containing the data items to display or print in the LIST. If the QUEUE has been dynamically created with NEW, the corresponding DISPOSE must come after the window has been closed.|
The FROM attribute (PROP:FROM, write-only) specifies the source of the data elements displayed in a LIST, COMBO, or SPIN control, or printed in a LIST control.
If a string constant is specified as the source, the individual data elements must be delimited by a vertical bar (|) character. To include a vertical bar as part of one data element, place two adjacent vertical bars in the string (||), and only one will be displayed. To indicate that an element is empty, place at least one blank space between the two vertical bars delimiting the elements (| |). Normally, a valid event will move the selected data element's contents into the control's USE variable. However, an alternate value can also be specified in the FROM attribute by including an additional vertical bar followed by a pound symbol (#), and followed by the alternate value. This technique is also useful for the display of special characters. For example, to display the # character in the listbox using a string as a source for FROM, it's enough if the previous entry is
defined with alternate value:
For a SPIN control, the source would usually be a QUEUE field or string. If the source is a QUEUE with multiple fields, only the first field is displayed in the SPIN.
For LIST and COMBO controls, the data elements are formatted for display according to the information in the FORMAT attribute. If the label of a QUEUE is specified as the source, all fields in the QUEUE are displayed as defined by the FORMAT attribute. If the label of one field in a QUEUE is specified as the source, only that field is displayed. Queue elements that contain vertical bar characters are treated as a single list entry.
If the label of a QUEUE is specified as the source, all fields in the QUEUE are printed. If the label of one field in a QUEUE is specified as the source, only that field is printed. Only the current QUEUE entry in the queue's data buffer is printed in the LIST. If a string constant or variable is specified as the source, the entire string (all entries in the vertical bar delimited list of data elements) is printed in the LIST. The data elements are formatted for printing in the LIST according to the information in the FORMAT attribute.
TD QUEUE,AUTO FName STRING(20) LName STRING(20) Init STRING(4) Wage REAL END CustRpt REPORT,AT(1000,1000,6500,9000),THOUS CustDetail DETAIL,AT(0,0,6500,1000) LIST,AT(0,34,366,146),FORMAT('80L80L16L60L'),FROM(TD),USE(?Show1) LIST,AT(0,200,100,146),FORMAT('80L'),FROM(Fname),USE(?Show2) END END Que1 QUEUE,PRE(Q1) F1 LONG F2 STRING(8) END Win1 WINDOW,AT(0,0,160,400) LIST,AT(120,0,20,20),USE(?L1),FROM(Que1),FORMAT('5C~List~15L~Box~'),COLUMN COMBO(@S8),AT(120,120,20,20),USE(?C1),FROM(Q1:F2) SPIN(@N8.2),AT(280,0,20,20),USE(SpinVar1),FROM(Q1:F1) SPIN(@S4),AT(280,0,20,20),USE(SpinVar2),FROM('Mr.|Mrs.|Ms.|Dr.') !Assign a numeric value to SpinVar3: SPIN(@S4),AT(280,0,20,20),USE(SpinVar3),FROM('Mr.|#1|Mrs.|#2|Ms.|#3|Dr.|#4') END