Navigation: Language Reference App C - PROP: Runtime Properties Complete Property List ====== PROP:VLBproc and PROP:VLBval ====== | |
PROP:VLBProc sets the source procedure for a “Virtual List Box” LIST or COMBO control without a FROM attribute. This procedure provides the control with the data to display.
The procedure's prototype must take three parameters:
VLBProc PROCEDURE(LONG,LONG,SHORT),STRING
where the first LONG is either SELF (indicating the procedure is a method of a CLASS) or the value set for PROP:VLBval. The second LONG passes the row number of the virtual list box to affect. There are three “special” values for this parameter, -1 asks for the number of records to display in the list, -2 asks for the number of fields in the nominal Queue (data and color/tree/icon fields) to display in the list, and -3 asks if there are any changes to display. The SHORT parameter specifies the column number of the virtual list box to affect.
PROP:VLBVal sets the source object for a “Virtual List Box” LIST or COMBO control without a FROM attribute. This can be any 32-bit unique value to identify the specific list box, but is generally the return value of ADDRESS(SELF) when the PROP:VLBProc procedure is a CLASS method.
Example:
PROGRAM MAP Main END StripedListQ QUEUE,TYPE S STRING(20) END StripedList CLASS,TYPE Init PROCEDURE(WINDOW w, SIGNED feq, StripedListQ Q) VLBproc PROCEDURE(LONG row, SHORT column),STRING,PRIVATE !Required first parameter is implicit in a CLASS method Q &StripedListQ,PRIVATE ochanges LONG,PRIVATE END CODE Main StripedList.Init PROCEDURE(WINDOW w, SIGNED feq, StripedListQ Q) CODE SELF.Q &= Q SELF.ochanges = CHANGES(Q) w $ feq{PROP:VLBval} = ADDRESS(SELF) !Must assign this first w $ feq{PROP:VLBproc} = ADDRESS(SELF.VLBproc) ! then this StripedList.VLBproc PROCEDURE(LONG row, SHORT col) !Required first parameter is implied nchanges LONG CODE CASE row OF -1 ! How many rows? RETURN RECORDS(SELF.Q) OF -2 ! How many columns? RETURN 5 ! 1 data, four color fields in the "nominal Q" OF -3 ! Has it changed nchanges = CHANGES(SELF.Q) IF nchanges <> SELF.ochanges THEN SELF.ochanges = nchanges RETURN 1 ELSE RETURN 0 END ELSE GET(SELF.Q, row) CASE col OF 1 !Data field RETURN WHAT(SELF.Q,1) OF 3 !Background color field RETURN CHOOSE(BAND(row,1), COLOR:none, 0c00000H) ELSE !All other fields RETURN COLOR:None ! Use default color END END Main PROCEDURE window WINDOW('Caption'),AT(,,153,103),GRAY,SYSTEM LIST,AT(33,12,80,80),USE(?List1),FORMAT('20L*') END Q QUEUE(StripedListQ) END SL StripedList i SIGNED CODE LOOP i = 1 TO 20 Q.s = 'Line ' & i ADD(Q) END OPEN(window) SL.Init(window, ?list1, Q) ACCEPT END