Chapter Contents

Previous

Next
SAS/AF Software: Class Dictionary

Row/Column Data Vector Examples

The first example subclasses the Data Set Data Model class and overrides its _getColumnInfo method. The second example subclasses the Data Set Data Model class and overrides its _getColumnInfo and _getRowInfo methods. Then Row/Column Data Vector methods are used to set each of the items. Finally, in a frame, a form editor and a table editor are created that use the Data Set Data Model subclass.


Overriding the _getColumnInfo Method with a Form Editor

The following is the SCL code for the subclass's _getColumnInfo method used with the form editor.

getcoli:
method rcdvecid 8;
viewerid = getnitemn(_SELF_,'VIEWERID');
call super(_SELF_, '_getColumnInfo', 
            rcdvecid);
collst = makelist();
call send(rcdvecid, '_getCoordinates',
          collst);
colnum = getitemn(collst, 1);
 Note about code
if colnum eq 1 then do;
  flist = makelist();
  flist = setnitemn(flist, 0, 'OPTIONS');
  flist = setnitemn(flist, 2, 'FAMILY');
  flist = setnitemn(flist, -1, 'CHARSET');
  flist = setnitemn(flist, 60, 'POINTS');
  flist = setnitemn(flist, 1, 'STYLE');
  flist = setnitemn(flist, 9, 'WEIGHT');
  flist = setnitemn(flist, -1, 'WIDTH');
  flist = setnitemn(flist, 1, 'PORTABLE');
  flist = setnitemn(flist, 0.46875, 'RATIO');
  call send(rcdvecid, '_setFont', flist);
end;
 Note about code
if colnum eq 3 then do;
 call send(rcdvecid, '_setColor', 'RED');
end;
 Note about code
if colnum eq 4 then do;
 call send(rcdvecid, '_setBackgroundColor',
          'GREEN');
end;
 Note about code
if colnum eq 5 then do;
  call send(rcdvecid, '_setClassName', 
           'sashelp.fsp.gtext');
  oid = loadclass('sashelp.fsp.gtext');
  ivl = getniteml(oid, '_iv');
  ivl2 = copylist(ivl, 'Y');
  rc = setlattr(ivl2, 'UPDATE');
 Note about code
rc = setnitemn(ivl2, 3, 'ROTATE');
 call send(rcdvecid, '_setClassProperties',
           ivl2);
 end;
 Note about code
if colnum eq 6 then do;
  call send(rcdvecid, '_setRepresentation',
           'REGTITLE');
end;

endmethod;


Overriding the _getColumnInfo Method with a Table Editor

The following is the SCL code for the subclass's _getColumnInfo method used with the table editor.

getcoli:
method rcdvecid 8;
viewerid = getnitemn(_SELF_,'VIEWERID');
call super(_SELF_, '_getColumnInfo',
            rcdvecid);
collst = makelist();
call send(rcdvecid, '_getCoordinates',
          collst);
colnum = getitemn(collst, 1);
 Note about code
if colnum eq 1 then do;
  flist = makelist();
  flist = setnitemn(flist, 0, 'OPTIONS');
  flist = setnitemn(flist, 2, 'FAMILY');
  flist = setnitemn(flist, -1, 'CHARSET');
  flist = setnitemn(flist, 60, 'POINTS');
  flist = setnitemn(flist, 1, 'STYLE');
  flist = setnitemn(flist, 9, 'WEIGHT');
  flist = setnitemn(flist, -1, 'WIDTH');
  flist = setnitemn(flist, 1, 'PORTABLE');
  flist = setnitemn(flist, 0.46875, 'RATIO');
  call send(rcdvecid, '_setFont', flist);
end;
 Note about code
if colnum eq 2 then do;
  call send(rcdvecid, '_setHjust', 'LEFT');
end;
 Note about code
if colnum eq 3 then do;
  call send(rcdvecid, '_setDimension', 0.1,
           'in');
end;
 Note about code
if colnum eq 5 then do;
  call send(rcdvecid, '_setAlignmentChar',
            '.');
  call send(rcdvecid, '_setAlignment', 0.8,
           'in');
  call send(rcdvecid, '_setAlignJust',
           "RIGHT");
end;
 Note about code
if colnum eq 6 then do;
  call send(rcdvecid, '_setAlignmentChar', '.');
  call send(rcdvecid, '_setDecimals', 1);
  call send(rcdvecid, '_setAlignJust',
           "RIGHT");
end;

endmethod;


Overriding the _getRowInfo Method with a Table Editor

The following is the SCL code for the subclass's _getRowInfo method used with the table editor.

getrowi:
method rcdvecid 8;
viewerid = getnitemn(_SELF_,'VIEWERID');
call super(_SELF_, '_getRowInfo', 
            rcdvecid);
rowlst = makelist();
call send(rcdvecid, '_getCoordinates',
          rowlst);
rownum = getitemn(rowlst, 1);
 Note about code
if rownum eq 1 then do;
  call send(rcdvecid, '_setColor', 'RED');
end;
 Note about code
if rownum eq 2 then do;
  call send(rcdvecid, '_setBackgroundColor',
           'GREEN');
end;
 Note about code
if rownum eq 3 then do;
  call send(rcdvecid, '_setDimension',
            0.5, 'in');
  call send(rcdvecid, '_setVjust',
           'BOTTOM');
end;
 Note about code
if rownum eq 4 then do;
  alist = makelist();
  alist = setnitemc(alist, 'N', 
                   'LABEL_BUTTONS');
  call send(viewerid, '_setAttributes', 
            alist);
  call send(rcdvecid, '_setBorderColor',
           'ALL', 'YELLOW');
  call send(rcdvecid, '_setBorderWidth',
          'ALL', 0.1, 'in');
end;
 Note about code
if rownum eq 5 then do;
  call send(rcdvecid, '_setBorderStyle',
           'ALL', 'DASHED');
  call send(rcdvecid, '_setBorderWidth', 
           'ALL', 0.1, 'in');
end;
 Note about code
  if rownum eq 6 then do;
  call send(rcdvecid, '_setBorderWidth', 
           'ALL', 0.1, 'in');
end;
 Note about code
if rownum eq 7 then do;
  call send(rcdvecid, '_setMargin', 'RIGHT',
            0.7, 'in');
end;
 Note about code
if rownum eq 8 then do;
  call send(rcdvecid, '_setReverse', 'Y');
end;
 Note about code
if rownum eq 9 then do;
  call send(rcdvecid, '_setDimension',
            0.5, 'in');
  call send(rcdvecid, '_setAlignment',
           0.4, 'in');
end;
 Note about code
if rownum eq 10 then do;
  call send(rcdvecid, '_setNameJust', -1);
end;
 Note about code
if rownum eq 11 then do;
  call send(rcdvecid, '_setText', 'newlab');
end;

endmethod;


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.