Jump to content


Photo

Use of Column.OnResize with RefreshColumn(,,gridArea param)


  • Please log in to reply
No replies to this topic

#1 BelangerC

BelangerC

    Senior Member

  • Members
  • PipPip
  • 221 posts
  • Location:Richmond, CA USA
  • Interests:Alternative medicine, programming for

Posted 05 June 2023 - 01:08 PM

Hi, Boki:

 

Thank you for your previous topic/question answers. They are a big help in my conversion project.

 

So, in NG5.OnColumnResize

 

I am assuming that the correct event in NG6 is the OnResize event for each column, yes?

I have a question about the old code transfer. See below:

 

 

I have:

 

 ACol := TNxColumn6(Sender).Index;
 // use this to make changes in Col width; store in db for this Table-Column
  // first, force a repaint of the grid, to show the new col width
  // Hold off letting this fire until after form show, otherwise it resets the
  // col width
 
  // 9/10/08 allow user to set widths during a patient session, but not make
  // them permanent
 
  WITH NxReportGridView61 DO
  BEGIN
    // not sure that the refresh column actually works, the repaint does for sure
    FOR i := ACol TO Columns.Count - 1 DO <== previously did a refresh column for each column in the grid. Wondering if I need to do that when using the newer RefreshColumn method with gaALL?
//I am thinking that a single call to RefreshColumn will properly adjust the grid look. Am I correct, or do I still need to RefreshColumn for each column?
 
    BEGIN
    //2nd param is:
    //TNxGridArea = (gaAll, gaBody, gaFooter, gaHeader, gaHeaderClient, gaHeaderDropButton, gaInsertRow);
 
      RefreshColumn(Columns[i], gaAll);  //gaAll is a guess, might mean I only
      //need to refresh the actual column being resized if I use gaALL.
    END;
 
    GridView2.Repaint;
  END;
 
  IF TV.EditTreeTable AND TV.CVTableShow THEN
  BEGIN
  dsql := TIB_DSQL.Create(self);
  try
    // Save changes to database
    WITH dsql DO
    begin
    IB_Connection := modData.IB_Connection1;
    IB_Transaction := modData.IB_Transaction1;
 
      SQL.Clear;
      SQL.Add('UPDATE CV_TABLE_Columns ');
      SQL.Add('SET TABLE_Col_width = ' +
        IntToStr(GridView2.Columns[ACol].Width));
      SQL.Add('WHERE CV_TABLE_ID = ' + IntToStr(TV.CVTableID));
      SQL.Add('AND TABLE_COL_ORDER = ' + IntToStr(ACol + 1));
      ExecSQL;
      IB_Transaction.Commit
     // UpdateRecord;
    END;
    finally
    FreeAndNil(dsql);
  END;
  END;





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users