Jump to content

Recommended Posts

  • Moderators

I gave the Grid component as bundled with V2 a go.


The workflow is to define the grid, then the columns, then the rows and last the cells


MyGrid := TW3Grid.Create(Self); 
MyGrid.Color := cllightblue; 

MyColumn1 := TW3Column.Create(mygrid as IW3ColumnsControl); 
MyColumn1.Width :=200; 
MyColumn1.Header.Caption := 'header1'; 

MyColumn2 := TW3NumberColumn.Create(mygrid as IW3ColumnsControl); 
MyColumn2.Width :=200; 
MyColumn2.Header.Caption := 'header2'; 
MyColumn2.TextAfter := ' AUD';   // special for number columns 
MyColumn2.TextBefore := '$ '; 


MyGrid.AddRow(2); // add 2 rows 
MyGrid.Cell[0, 0].SetValue('kkk'); 
MyGrid.Cell[1, 1].SetValue(300); 


This works. The standard package has a number of problems. The following solutions have been provided by the author (Berg) :


The headers are being overwritten when scrolling up/down. This can be solved by adding the following script to the css file :

.TW3ColumnHeader { 
  color: #fff; 
  font-size: small; 
  font-weight: normal; 
  background: #9e2b83; 
  border-right: 1px solid #b660a2; 
  padding-left: 4px; 

The other problem is that the BeforeText parameter for Number Columns does not work. Changing the following code will solve that :


function TW3NumberColumn.GetDisplayHtml(Sender: TW3Component; Value: Variant): String; 
  Result := FloatToStr(Value, FPrecision); 

  Result := TextBefore + Result + TextAfter; 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...