DBNavigator and the visible buttons

kacor used Ask the Experts™
Hi Experts,
This is a Delphi6 project. There is a DataModul1 contaning all data connections. The Form1 has a DBNavigator1 connected to Table1 on DataModul1, a bitButton1, some data-aware controls, and uses DataModul1. DBNavigator1 is set to surf between data e.g. visible buttons are nbFirst, nbPrior, nbNext and nbLast.
On Form1 it possible1 to activate all buttons of the DBNavigator1 by clicking the bitButton:

   Form1.DBNavigator1.VisibleButtons :=
      [nbFirst,nbPrior,nbNext,nbLast, nbInsert, nbDelete, nbEdit,
       nbPost, nbCancel, nbRefresh];
it works. But if I try to set to one event of the Table1 (for example to the event AfterCancel as follows) the button set restriction:

procedure TDataModule1.Table1AfterCancel(DataSet: TDataSet);
   // nem lehet szerkeszteni
   Form1.DBNavigator1.VisibleButtons := [nbFirst,nbPrior,nbNext,nbLast];

I get a lot of error messages:

[Error] DataModule1.pas(105): Undeclared identifier: 'nbFirst'
[Error] DataModule1.pas(105): Undeclared identifier: 'nbNext'
[Error] DataModule1.pas(105): Incompatible types: 'TNavigateBtn' and 'Integer'
[Fatal Error] Project1.dpr(7): Could not compile used unit 'DataModule1.pas'

How can I solve this problem? Thank you for your help.

with best regards

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software Developer

  Just add DBCtrls to the uses clause


Hi mnasman,

at first I wish you a happy new year and good health!

Rigth, I have choosen a bad way. In the meantime I've got a better idea to use a Boolean variable to switch between the two states Edit or Search only, and in an IF statement I can decide which set to use.

Again thanks for your help


Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial