Jump to content

Refresh ReadOnly dataset using UniDBNavigator


Hassan

Recommended Posts

Hi,

 

UniDBNavigator refresh button is disabled when DataSet is read-only.

I have read-only dataset. For different reasons user need to click on REFRESH button of UNIDBNAVIGATOR which is referencing to this read-only dataset.

 

Is there a way to make Refresh button active for read-only data-set?

 

Thanks.

Link to comment
Share on other sites

Hi,

 

Can you try this approach ?!:

 

1.

uses ... DBCtrls;

2.

type
  TExUniDBNavigator = class(TUniDBNavigator)

  end;

3.  UniDBGrid -> OnAfterLoad:

procedure TMainForm.UniDBGrid1AfterLoad(Sender: TUniDBGrid);
begin
  TExUniDBNavigator(UniDBNavigator1).Buttons[nbRefresh].Enabled := True;
end;

Best regards,

  • Upvote 1
Link to comment
Share on other sites

That works. But I will need to add it to all grids with readonly dataset...

procedure TUniDBNavigator.EditingChanged;
var
  CanModify: Boolean;
begin
  if IsDestroying then Exit;

  CanModify := Enabled and FDataLink.Active and FDataLink.DataSet.CanModify;
  Buttons[nbInsert].Enabled := CanModify;
  Buttons[nbEdit].Enabled := CanModify and not FDataLink.Editing;
  Buttons[nbPost].Enabled := CanModify and FDataLink.Editing;
  Buttons[nbCancel].Enabled := CanModify and FDataLink.Editing;
  Buttons[nbRefresh].Enabled := CanModify;
end;

I see in UniDBNavigator.pas , it is enabled based on 'Enabled and FDataLink.Active and FDataLink.DataSet.CanModify;' (above code).

To me it should be as follows:

procedure TUniDBNavigator.EditingChanged;
var
  CanModify: Boolean;
begin
  if IsDestroying then Exit;

  CanModify := Enabled and FDataLink.Active and FDataLink.DataSet.CanModify;
  Buttons[nbInsert].Enabled := CanModify;
  Buttons[nbEdit].Enabled := CanModify and not FDataLink.Editing;
  Buttons[nbPost].Enabled := CanModify and FDataLink.Editing;
  Buttons[nbCancel].Enabled := CanModify and FDataLink.Editing;
  Buttons[nbRefresh].Enabled := Enabled and FDataLink.Active;
end;

Is this change can be applied?

Thanks.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...