Hassan Posted July 7, 2017 Share Posted July 7, 2017 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 More sharing options...
Sherzod Posted July 7, 2017 Share Posted July 7, 2017 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, 1 Link to comment Share on other sites More sharing options...
Hassan Posted July 7, 2017 Author Share Posted July 7, 2017 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 More sharing options...
Administrators Farshad Mohajeri Posted July 9, 2017 Administrators Share Posted July 9, 2017 Hi Unigui dbnavigator works same as standard VCL dbnavigator. Sent from my SM-N900 using Tapatalk Link to comment Share on other sites More sharing options...
Hassan Posted July 10, 2017 Author Share Posted July 10, 2017 OK, Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now