How to Detect record navigation lazarus / 16-Databases ---------------------------------------------------------------------- timcs · 2015-05-19 06:51 Hi   I am sure that this is something very simple but I cannot see how or were to place this. I am trying to detect when a database move next previous last or first buttons are used via the dbnavigator object on a postgres database.  I have tried to use the DBnavigator OnClick procedure but I cannot see a method such as a boolean for if next , prior , last or first to use with an if statement Can anyone please help ? Thanks TimCS ---------------------------------------------------------------------- howardpc · 2015-05-19 08:06 I guess you want a more intelligent modification of the following: Code: [Select]procedure TForm1.DBNavigator1Click(Sender: TObject; Button: TDBNavButtonType); begin   case Button of     nbFirst: ;     nbPrior: ;     nbNext: ShowMessage('Next button pressed');     nbLast: ;     nbInsert: ;     nbDelete: ;     nbEdit: ;     nbPost: ;     nbCancel: ;     nbRefresh: ;   end; end; ---------------------------------------------------------------------- timcs · 2015-05-19 09:23 Hi Howardpc   I will give this ago but I did use the button.nbNext as an if condition but that did not work but the case make work. Thanks for that TimCS ---------------------------------------------------------------------- rvk · 2015-05-19 10:50 Quote from: timcs on May 19, 2015, 11:23:29 am  I will give this ago but I did use the button.nbNext as an if condition but that did not work but the case make work. Mmmm, that's weird... An if-condition on button should have worked too. Code: [Select]procedure TForm1.DBNavigator1Click(Sender: TObject; Button: TDBNavButtonType); begin   if Button = nbNext then   begin     ShowMessage('Next button pressed');   end; end; ---------------------------------------------------------------------- timcs · 2015-05-19 11:05 Quote from: rvk on May 19, 2015, 12:50:58 pmQuote from: timcs on May 19, 2015, 11:23:29 am  I will give this ago but I did use the button.nbNext as an if condition but that did not work but the case make work. Mmmm, that's weird... An if-condition on button should have worked too. Code: [Select]procedure TForm1.DBNavigator1Click(Sender: TObject; Button: TDBNavButtonType); begin   if Button = nbNext then   begin     ShowMessage('Next button pressed');   end; end; That explains it I made a syntax error I tried : Quoteif button.nbNext Thanks TimCS ---------------------------------------------------------------------- totya · 2015-05-20 17:47 Quote from: timcs on May 19, 2015, 01:05:19 pmThat explains it I made a syntax error I tried : Quoteif button.nbNext See rvk code carefully. He wrote this: Code: [Select]if Button = nbNext then ---------------------------------------------------------------------- rvk · 2015-05-20 17:55 Quote from: totya on May 20, 2015, 07:47:25 pmQuote from: timcs on May 19, 2015, 01:05:19 pmThat explains it I made a syntax error I tried : Quoteif button.nbNext See rvk code carefully. He wrote this: Code: [Select]if Button = nbNext then That's not what he meant. He already stated in reply #2 that he first tried "button.nbNext" in the if-statement. After seeing my "if Button = nbNext then" he says that he now understands why he got the syntax error in the first place. So he understands what he did wrong and the problem is resolved. ---------------------------------------------------------------------- totya · 2015-05-20 18:01