这是 delphi 帮助中 DBNatigator OnClick 事件的定义,
type ENavClick = procedure (Sender: TObject; Button: TNavigateBtn) of object;
property OnClick: ENavClick;
这是 Button 参数的定义:
type TNavigateBtn = (nbFirst, nbPrior, nbNext, nbLast, nbInsert, nbDelete, nbEdit, nbPost, nbCancel, nbRefresh);
Description
Each TNavigateBtn value identifies a different button that can appear on a TDBNavigator object. The following table lists all the button types, their corresponding TNavigateBtn values, and the action associated with each button:
Button Value Action
First nbFirst Go to the first record
Prior nbPrior Go to the previous record
Next nbNext Go to the next record
Last nbLast Go to the last record
Insert nbInsert Insert a blank record
Delete nbDelete Delete the current record
Edit nbEdit Permit users to edit the current record
Post nbPost Post the current record
Cancel nbCancel Cancel the current edit
Refresh nbRefresh Refresh the data in the dataset
所以,答案是在 onclick 事件中判断 button 是哪一个