sDbGrid Title in runtime

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #38329
    ariopax
    Participant

    Hi

    If you create sDbGrid in runtime and set title caption.

    The title caption don't showed.

    Code:
    Result:=TsDBGrid.Create(myform);
    Columns.Clear;
    For i := 0 To MyTable.FieldCount – 1 do
    Begin
    Columns.Add;
    Result.Columns.Field := MyTable.Fields;
    Result.Columns.FieldName := MyTable.Fields.FieldName;
    Result.Columns.Title.Caption := MyTable.Fields.DisplayLabel;
    End;

    Best Regards.

    #59801
    Witcher
    Participant

    Hello!

    Something wrong with your code sample.

    For example, what about DataSource and Parent for your Grid?

    I wrote code to check your question and my code works perfectly:

    Code:
    procedure TForm1.FormShow(Sender: TObject);
    var
    i : Integer;
    sDBGrid: TsDBGrid;
    begin
    sDBGrid := TsDBGrid.Create(Self); // Create sDBGrid instance
    sDBGrid.Parent := Self; // Grid will be placed on Form1
    sDBGrid.DataSource := dsApps; // dsApps is TDataSource component created in design-time and linked to TClientDataSet instance
    sDBGrid.Columns.Clear; // Clear columns for sure
    cdsApps.Open; // Activate our dataset
    for i := 0 to cdsApps.FieldCount – 1 do
    Begin
    sDBGrid.Columns.Add;
    sDBGrid.Columns.Field := cdsApps.Fields;
    sDBGrid.Columns.FieldName := cdsApps.Fields.FieldName;
    sDBGrid.Columns.Title.Caption := cdsApps.Fields.DisplayLabel + '_test'; // “_test” suffix placed here to
    // view difference between default column title values
    End;
    end;

    So, it seems that your question not related with AlphaControls directly, because your sample above will not works with any DBGrid.

    #59802
    ariopax
    Participant

    Hi

    If select xp luna or xp silver ,when click on dbgrid cell ,its content hide.

    Best Regards.

    #59805
    Witcher
    Participant

    What version of AlphaControls do you use?

    I have made checking with 14.29 – all cell's content draws correctly with XPLina and XPSilver skins.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.