Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 16 Jan 2022, 11:06

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: 13 Nov 2012, 09:04 
Offline

Joined: 13 Nov 2012, 07:52
Posts: 1
При тесте возможности перехода с EhLib 4 на EhLib 6 получили следующую проблему

если к DataSet привязан DBGridEh (DBGridEh.DataSource.DataSet)

то сдедующий код приводит к зависанию программы (после нажатия на кнопку):
Code:
procedure TForm2.Button2Click(Sender: TObject);
begin
  pFIBDataSet1.DisableControls;
  try
    pFIBDataSet1.CloseOpen(False);
  finally
    pFIBDataSet1.EnableControls;
  end;
end;

procedure TForm2.pFIBDataSet1BeforeOpen(DataSet: TDataSet);
var FieldDef : TFieldDef;
      fldNew : TField;
      i : Integer;
      is1 : Boolean;
      ds : TDataSource;
begin
  TpFIBDataSet(DataSet).Prepare;
  DataSet.Fields.Clear; //Очистка полей [color=#FF0000]<- Тут происходит зависание[/color]
  for i := 0 to DataSet.FieldDefs.Count - 1 // Пересоздание полей по умолчанию
  do begin
    FieldDef := DataSet.FieldDefs.Items[i];
    fldNew := FieldDef.CreateField(DataSet, nil, '', false);
  end;
end;


исходники и пример: http://yadi.sk/d/n1fagXE_0hgn3

проблема возникает только с DBGridEh (с TDBGrid проблемы нет, с версиями 4-й ветки EhLib тоже всё нормально)
Зацикливается TCustomDBGridEh.Notification(AComponent: TComponent; Operation: TOperation);
Code:
procedure TCustomDBGridEh.Notification(AComponent: TComponent; Operation: TOperation);
var
  I: Integer;
  NeedLayout: Boolean;
begin
  inherited Notification(AComponent, Operation);
  if (Operation = opRemove) then
  begin
    if (AComponent is TPopupMenu) then
    begin
      for I := 0 to Columns.Count - 1 do
        if Columns[I].PopupMenu = AComponent
          then Columns[I].PopupMenu := nil;
    end
    else if (AComponent is TCustomImageList) then
    begin
      if TitleImages = AComponent then TitleImages := nil;
      for I := 0 to Columns.Count - 1 do
        if Columns[I].ImageList = AComponent then
          Columns[I].ImageList := nil;
    end else if (AComponent is TScrollBar) then
    begin
      if VertScrollBar.ExtScrollBar = AComponent then
        VertScrollBar.ExtScrollBar := nil
      else if HorzScrollBar.ExtScrollBar = AComponent then
        HorzScrollBar.ExtScrollBar := nil
    end else if (AComponent is TDataSource) then
    begin
      for I := 0 to Columns.Count - 1 do
        if Columns[I].DropDownBox.ListSource = AComponent then
          Columns[I].DropDownBox.ListSource := nil;
      if (FDataLink <> nil) and (AComponent = DataSource) then
        DataSource := nil;
    end
    else if (FDataLink <> nil) then
      if (AComponent is TField) then
      begin
       // [color=#BF0000]if FDatalink.Dataset.ControlsDisabled then exit; [/color] //Решает проблему но какими будут последствия?
        NeedLayout := False;
        for I := 0 to Columns.Count - 1 do
          with Columns[I] do
            if Field = AComponent then
              NeedLayout := True;
        if NeedLayout then
        begin
          BeginLayout;
          try
            for I := 0 to Columns.Count - 1 do
              with Columns[I] do
                if Field = AComponent then
                begin
                  [color=#FF0000]Field := nil;[/color] // проблема где то здесь
                  //NeedLayout := True;
                end;
          finally
            if Assigned(FDatalink.Dataset)
              and not FDatalink.Dataset.ControlsDisabled then
              EndLayout
            else
              DeferLayout;
          end;
        end;
      end
    else if (AComponent is TDataSet) then
    begin
      CheckIMemTable;
      if ViewScroll then
      begin
        UpdateRowCount;
        MTViewDataEvent(-1, mtViewDataChangedEh, -1);
      end;
      LayoutChanged;
    end;
  end;
end;


Ehlib 6.0 Full Source, Fib 7.3, D2007, W7x64 and WXPx32


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group