Title: How to Enable the Refresh button on a DBNavigator for ReadOnly Datasets
When using the TDBNavigator component with read-only datasets, the Refresh button is disabled by design.
In many situations you will have a read-only dataset displayed in a DBGrid, connected to a DBNavigator where DataSet's (TxxxTable or TxxxQuery) Refresh method is expected and "legal".
Here's how to re-enable the DBNavigator's Refresh button:
Expose the Buttons property of the DBNavigator by using the protected hack method. First we create a class to access the protected members of a DBNavigator:
TDBNavigatorEx = class(TDBNavigator) ;
Set Enable = true for the Refresh button inside the dataset's OnOpen event handler.
TDBNavigatorEx(DBNavigator).Buttons[nbRefresh].Enabled := TRUE ;
Note: "DBNavigator" is the name of the DBNavigator component attached to a readonly datasource/dataset.
That's it. Now you can use the Refresh button even on a readonly dataset.