anchor.diff:        procedure Redraw;
         procedure OnCursorChange( Sender : TObject );
         procedure OnChooseType(val:variant);
  +      procedure OnToggle;
       end;
   
   
positive.code:      num, fx, ukm, kbd, undk, fs;
  
  type
    TDbOutCursor = class (udc.TDbCursor)
      public
        procedure Toggle;
      end;
    TDbOutlnApp  = class (uapp.TCustomApp)
      protected
        curs     : TDbOutCursor;
        dbc      : udb.TDatabase;
        view     : udv.TDbTreeGrid;
        typeMenu : udv.TDBMenu;
        pageMenu : udv.TDBMenu;
        rsOutln  : udb.TRecordSet;
  
negative.code: 
  procedure TDbOutlnApp.OnChooseType(val:variant);
    begin dbc.RunSQL(
      'UPDATE node SET knd=:knd WHERE nid=:nid', [val, cur['nid']]);
    end;
  
  procedure TDbOutLnApp.OnToggle;
    var olid, nid : integer; sql : TStr;
    begin
      olid := cur['olid']; nid  := cur['nid'];
      if cur['collapsed'] then sql :=
        'delete from outline_collapse where olid= :olid and collapse = :nid'
      else sql := 'insert into outline_collapse values (:olid, :nid)';
      dbc.RunSQL(sql, [olid, nid]);
      rsOutln.Open; treegrid.redraw; // refresh the data and display
    end;
  
  