Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Width of IWGrid is not updated



Permlink Replies: 2 - Last Post: Jul 31, 2017 1:32 AM Last Post By: Wolfgang Zehntner
Wolfgang Zehntner

Posts: 52
Registered: 9/12/16
Width of IWGrid is not updated
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 30, 2017 11:18 PM
The cells of a IWGrid are automatically adjusted to the Textwidth of the cells text (which is good and works wonderfully).
However the IWGrid.width is not updated.
This leads to incorrect display of other grids, e.g. when the grids are left-aligned.
Here is the code to reproduce:
unit Unit1;
 
interface
 
uses
  Classes, SysUtils, IWAppForm, IWApplication, IWColor, IWTypes,
  IWVCLBaseControl, IWBaseControl, IWBaseHTMLControl, IWControl, IWCompGrids,
  Vcl.Controls, Vcl.Forms, IWVCLBaseContainer, IWContainer, IWHTMLContainer,
  IWHTML40Container, IWRegion, IWCompButton;
 
type
  TIWForm1 = class(TIWAppForm)
    IWRegion1: TIWRegion;
    IWGrid1: TIWGrid;
    IWGrid2: TIWGrid;
    IWButton1: TIWButton;
    procedure IWAppFormCreate(Sender: TObject);
    procedure IWButton1Click(Sender: TObject);
  public
  end;
 
implementation
 
{$R *.dfm}
 
 
procedure TIWForm1.IWAppFormCreate(Sender: TObject);
begin
   IWGrid1.ColumnCount := 1;
   IWGrid1.RowCount := 1;
   IWGrid1.cell[0,0].Text := 'short';
 
   IWGrid2.ColumnCount := 1;
   IWGrid2.RowCount := 1;
   IWGrid2.cell[0,0].Text := 'Test';
end;
 
procedure TIWForm1.IWButton1Click(Sender: TObject);
begin
   IWGrid1.Cell[0,0].Text := 'very long text to change width,; however IWGrid1.width is not changed';
end;
 
initialization
  TIWForm1.SetAsMainForm;
 
end.


and the corresponding dfm:
object IWForm1: TIWForm1
  Left = 0
  Top = 0
  Width = 555
  Height = 400
  RenderInvisibleControls = True
  AllowPageAccess = True
  ConnectionMode = cmAny
  OnCreate = IWAppFormCreate
  Background.Fixed = False
  HandleTabs = False
  LeftToRight = True
  LockUntilLoaded = True
  LockOnSubmit = True
  ShowHint = True
  XPTheme = True
  DesignLeft = 8
  DesignTop = 8
  object IWButton1: TIWButton
    Left = 192
    Top = 40
    Width = 75
    Height = 25
    Caption = 'IWButton1'
    Color = clBtnFace
    Font.Color = clNone
    Font.Size = 10
    Font.Style = []
    FriendlyName = 'IWButton1'
    TabOrder = 0
    OnClick = IWButton1Click
  end
  object IWRegion1: TIWRegion
    Left = 96
    Top = 112
    Width = 385
    Height = 201
    RenderInvisibleControls = True
    BorderOptions.NumericWidth = 1
    BorderOptions.BorderWidth = cbwNumeric
    BorderOptions.Style = cbsSolid
    BorderOptions.Color = clNone
    object IWGrid1: TIWGrid
      Left = 1
      Top = 1
      Width = 153
      Height = 199
      Align = alLeft
      BorderColors.Color = clNone
      BorderColors.Light = clNone
      BorderColors.Dark = clNone
      BGColor = clNone
      BorderSize = 1
      BorderStyle = tfDefault
      Caption = 'IWGrid1'
      CellPadding = 0
      CellSpacing = 0
      Font.Color = clNone
      Font.Size = 10
      Font.Style = []
      FrameBuffer = 40
      Lines = tlAll
      UseFrame = False
      UseSize = True
      FriendlyName = 'IWGrid1'
      ColumnCount = 1
      RowCount = 1
      ShowEmptyCells = True
      ShowInvisibleRows = True
      ScrollToCurrentRow = False
      ExplicitLeft = 32
      ExplicitTop = 32
      ExplicitHeight = 150
    end
    object IWGrid2: TIWGrid
      Left = 154
      Top = 1
      Width = 148
      Height = 199
      Align = alLeft
      BorderColors.Color = clNone
      BorderColors.Light = clNone
      BorderColors.Dark = clNone
      BGColor = clNone
      BorderSize = 1
      BorderStyle = tfDefault
      Caption = 'IWGrid2'
      CellPadding = 0
      CellSpacing = 0
      Font.Color = clNone
      Font.Size = 10
      Font.Style = []
      FrameBuffer = 40
      Lines = tlAll
      UseFrame = False
      UseSize = True
      FriendlyName = 'IWGrid2'
      ColumnCount = 1
      RowCount = 1
      ShowEmptyCells = True
      ShowInvisibleRows = True
      ScrollToCurrentRow = False
      ExplicitLeft = 216
      ExplicitTop = 32
      ExplicitHeight = 150
    end
  end
end


Is there a workaround or will it be fixed in the next release?
Eitan Arbel

Posts: 508
Registered: 2/24/13
Re: Width of IWGrid is not updated
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 30, 2017 11:34 PM   in response to: Wolfgang Zehntner in response to: Wolfgang Zehntner
try to set :
IWGrid1.UseSize:=False;
Wolfgang Zehntner

Posts: 52
Registered: 9/12/16
Re: Width of IWGrid is not updated
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 31, 2017 1:32 AM   in response to: Eitan Arbel in response to: Eitan Arbel
Eitan Arbel wrote:
try to set :
IWGrid1.UseSize:=False;

If I use your suggestion, the Left-align still does not work correctly
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02