Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to simulate dbnavigator??

Status
Not open for further replies.

Richis

Programmer
Nov 10, 2004
13
LT
I have to put all dbnavigator functions into buttons
ex:
button1 does the same like nbdelete, and button2 does the same as nb insert, and so on...
thax for advices...
 
For each buttons OnClick event, enter the specific code. For example, if you are using a table which is hooked upto a DBGrid via a Datasource, you do something along the lines of :-
Code:
Table1.Next; //Go Forward One Record
Table1.Prior; //Go Back back one record
Table1.First; //Go to the first record in the table
Table1.Last; //Go to the last record in the table

To delete a record, the table needs to be in edit mode, so you would need something like :-

Code:
Table1.Edit;
Table1.Delete;

There plenty on this simple sort of setup in the Delphi help.

[blue]"Mr Flibble says: Game Over, boys!" [/blue]
 
EricDraven said:
To delete a record, the table needs to be in edit mode...

No, I don't think it does - I've NEVER had to do an .edit before I did a .delete and I've been working in Delphi almost 10 years.

However, Richis, you will probably want to put some sort of confirmation in your delete code. Something like this:
Code:
If messageDlg('Delete this record?', 
               mtConfirmation, [mbYes, mbNo], 0) = mrYes then
  Table1.Delete;

-Dell
 
if you use the Taction component
you assign the buttons to the actions.

then the buttons enable / disable acording to the table state ect and no code is required for append, delete save ect.

Aaron Taylor
John Mutch Electronics
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top