PeterdeB
asked on
How to handle the dbnavigator?
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
procedure gofirst;
..
procedure goprior;
..
TForm1.dbNavClick(Sender: TObject; Button: TNavigatorButton);
begin
If button=nbfirst then gofirst else
if button=nbprior then goprior etc.
end;
..
procedure goprior;
..
TForm1.dbNavClick(Sender: TObject; Button: TNavigatorButton);
begin
If button=nbfirst then gofirst else
if button=nbprior then goprior etc.
end;
ciuly can type faster than me!
>> ciuly can type faster than me!
actually, it's been almost an hour since he posted his question :P
actually, it's been almost an hour since he posted his question :P
what are you trying to do ?
you can provide your own routines instead of the datasets ones
you can provide your own routines instead of the datasets ones
>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.
we all wait for the Hourly Expert Alerts, by the look of it.
>> 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
actually, I was watching a movie :D I get the alerts by the minute :P
ASKER
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
Regards,
Peter
ASKER
As always muchos gracias my friend!
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).
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).
procedure TForm2.FormCloseQuery(Send er: TObject; var CanClose: Boolean);
begin
Sorry, it's not Accept, it's CanClose. In which case you can say
CanClose:=not tablex.modified;
begin
Sorry, it's not Accept, it's CanClose. In which case you can say
CanClose:=not tablex.modified;
ASKER