Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to handle the dbnavigator?

Posted on 2008-11-02
13
Medium Priority
?
286 Views
Last Modified: 2012-05-05
Hi Folks,

Using this procedure > TForm1.dbNavClick(Sender: TObject; Button: TNavigatorButton);
begin

How Can I differentiate which button is clicked a working sample would be great ;)

Regards,

Peter
0
Comment
Question by:PeterdeB
  • 6
  • 3
  • 3
  • +1
13 Comments
 

Author Comment

by:PeterdeB
ID: 22862752
Ah wait lol I can't right or better said I needn't?
0
 
LVL 28

Accepted Solution

by:
2266180 earned 2000 total points
ID: 22863076
the button clicked is in Button: TNavigatorButton

you use it like:

case button of
  nbFirst: showmessage('first clicked');
  nbprior:showmessage('prior clicked');
..... etc
end;
you can find teh possible values in help by clicking on TNavigateBtn and hitting ctrl+F1
here is the definition:
TNavigateBtn = (nbFirst, nbPrior, nbNext, nbLast,
                  nbInsert, nbDelete, nbEdit, nbPost, nbCancel, nbRefresh);
0
 
LVL 31

Expert Comment

by:moorhouselondon
ID: 22863085
procedure gofirst;
..

procedure goprior;
..


TForm1.dbNavClick(Sender: TObject; Button: TNavigatorButton);
begin
If button=nbfirst then gofirst else
if button=nbprior then goprior etc.
end;
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 31

Expert Comment

by:moorhouselondon
ID: 22863089
ciuly can type faster than me!
0
 
LVL 31

Expert Comment

by:moorhouselondon
ID: 22863096
bonus comment: more things to do with navigate

http://delphi.about.com/od/usedbvcl/l/aa090203a.htm
0
 
LVL 28

Expert Comment

by:2266180
ID: 22863104
>> ciuly can type faster than me!

actually, it's been almost an hour since he posted his question :P
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22863125
what are you trying to do ?
you can provide your own routines instead of the datasets ones
0
 
LVL 31

Expert Comment

by:moorhouselondon
ID: 22863169
>actually, it's been almost an hour since he posted his question :P

we all wait for the Hourly Expert Alerts, by the look of it.
0
 
LVL 28

Expert Comment

by:2266180
ID: 22863205
>> we all wait for the Hourly Expert Alerts, by the look of it.

actually, I was watching a movie :D I get the alerts by the minute :P
0
 

Author Comment

by:PeterdeB
ID: 22863850
Thanks all! I noticed that it was possible to edit the database without saving it, closing the program and then the modifications were lost. So I thouhgt maybe I could use the different buttons and buttonclicks in conjunction with teh close query to determine wheter or not to close the program. It's for a friend of mine.

Regards,

Peter

0
 

Author Closing Comment

by:PeterdeB
ID: 31512528
As always muchos gracias my friend!
0
 
LVL 31

Expert Comment

by:moorhouselondon
ID: 22865117
You can check if the table is in a Modified state.  Use CloseQuery to terminate the program, and set the "Accept" variable according to whether or not the table is in Modified state.  If you DoubleClick the CloseQuery Event on the Form, look at the header of the event, you will see the Accept variable there.  All you have to do is plonk the correct value in the procedure to either Accept the Close, or reject the Form's closure.

Other things that might be of interest:-

similarly, if you want the user to explicitly Post a Record before using First, Next, Prior, First or Last, you can either disable these buttons until Table Modified is False (either the user has pressed Post or Cancel), or you can wait for the user to press one of these buttons, then Showmessage('Can not do this'); if Table is Modified.

There is nothing to stop you having more than one DBNavigator for your Datasource - you could have one for First Prior Next Last, and another for the other Buttons/functions (Post, Cancel, etc).
0
 
LVL 31

Expert Comment

by:moorhouselondon
ID: 22865140
procedure TForm2.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin

Sorry, it's not Accept, it's CanClose.  In which case you can say

CanClose:=not tablex.modified;
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question