Board index » delphi » DBGrid. Prevent Post when moving cursur to another row. How ???

DBGrid. Prevent Post when moving cursur to another row. How ???

Hi,

This might be a faq but I haven't been able to find anything to solve my
problem.
I have a DBGrid with a DBNavigator. I want editing only be possible through
DBNavigator. Most of it works except the biggest problem. When in Edit state,
moving the cursor to another cell will automatically post the changes and I
don't want that. Is there a way to prevent this ??

TIA

Hendrik

|************** Wageningen Agricultural University. ************|
|  Department of Information Management and Datacommunication   |
-----------------------------------------------------------------
Hendrik Klompmaker: Senior Technologist
Internet          : Hendrik.Klompma...@Net.IenD.Wau.Nl
X400              : c=nl;a=400net;p=surf;o=wau;ou1=IenD
                  : ou2=Net;s=klompmaker;gi=hendrik
Phone             : +31 (0)317-484059
Fax               : +31 (0)317-482970
Snail             : Dreijenplein 2
                    6703 HB Wageningen / The Netherlands
-----------------------------------------------------------------

 

Re:DBGrid. Prevent Post when moving cursur to another row. How ???


Hendrick:
Boy have you touched a nerve!  I have the exact same problem with the new
ctrl grid in d2/3.  As a temporary fix, I modified the original code to
not allow this type of autopost.  When I get some time, I'm going to try
to make a descendant that overrides the autopost.  Failing that, I may
just use the altered source under another name.

I don't want to do it that way if I can avoid it.  There seems to be a
major rewrite of the ctrlgrid between d2 & d3 and I don't want to always
have to manually maintain my versions if I can avoid it.

So, the best guess is to alter the source for now or create your own.

-Dave

In article <33947d7...@wau.nl>, Hendrik.Klompma...@net.iend.wau.nl says...

Quote

>Hi,

>This might be a faq but I haven't been able to find anything to solve my
>problem.
>I have a DBGrid with a DBNavigator. I want editing only be possible
through
>DBNavigator. Most of it works except the biggest problem. When in Edit
state,
>moving the cursor to another cell will automatically post the changes and
I
>don't want that. Is there a way to prevent this ??

>TIA

>Hendrik

>|************** Wageningen Agricultural University. ************|
>|  Department of Information Management and Datacommunication   |
>-----------------------------------------------------------------
>Hendrik Klompmaker: Senior Technologist
>Internet          : Hendrik.Klompma...@Net.IenD.Wau.Nl
>X400              : c=nl;a=400net;p=surf;o=wau;ou1=IenD
>                  : ou2=Net;s=klompmaker;gi=hendrik
>Phone             : +31 (0)317-484059
>Fax               : +31 (0)317-482970
>Snail             : Dreijenplein 2
>                    6703 HB Wageningen / The Netherlands
>-----------------------------------------------------------------

--
Dave Krajcar, Alternative Solutions
rai...@pacifier.com

Re:DBGrid. Prevent Post when moving cursur to another row. How ???


If you are using Delphi2 you could use the cache updates.  But then it
will cache all updates.

John

Quote
Hendrik.Klompma...@net.iend.wau.nl (Hendrik Klompmaker) wrote:
>Hi,

>This might be a faq but I haven't been able to find anything to solve my
>problem.
>I have a DBGrid with a DBNavigator. I want editing only be possible through
>DBNavigator. Most of it works except the biggest problem. When in Edit state,
>moving the cursor to another cell will automatically post the changes and I
>don't want that. Is there a way to prevent this ??

>TIA

>Hendrik

>|************** Wageningen Agricultural University. ************|
>|  Department of Information Management and Datacommunication   |
>-----------------------------------------------------------------
>Hendrik Klompmaker: Senior Technologist
>Internet          : Hendrik.Klompma...@Net.IenD.Wau.Nl
>X400              : c=nl;a=400net;p=surf;o=wau;ou1=IenD
>                  : ou2=Net;s=klompmaker;gi=hendrik
>Phone             : +31 (0)317-484059
>Fax               : +31 (0)317-482970
>Snail             : Dreijenplein 2
>                    6703 HB Wageningen / The Netherlands
>-----------------------------------------------------------------

Re:DBGrid. Prevent Post when moving cursur to another row. How ???


Quote
In article <5n45p2$pn...@news.pacifier.com>, rai...@pacifier.com wrote:
>Hendrick:
>Boy have you touched a nerve!  I have the exact same problem with the new
>ctrl grid in d2/3.  As a temporary fix, I modified the original code to
>not allow this type of autopost.  When I get some time, I'm going to try
>to make a descendant that overrides the autopost.  Failing that, I may
>just use the altered source under another name.

>I don't want to do it that way if I can avoid it.  There seems to be a
>major rewrite of the ctrlgrid between d2 & d3 and I don't want to always
>have to manually maintain my versions if I can avoid it.

>So, the best guess is to alter the source for now or create your own.

Dave thanks for your reply. Can you give me some pointers what you changed
where (I guess thats dbgrids.pas...)

TIA

Hendrik

Quote

>-Dave

>In article <33947d7...@wau.nl>, Hendrik.Klompma...@net.iend.wau.nl says...

>>Hi,

>>This might be a faq but I haven't been able to find anything to solve my
>>problem.
>>I have a DBGrid with a DBNavigator. I want editing only be possible
>through
>>DBNavigator. Most of it works except the biggest problem. When in Edit
>state,
>>moving the cursor to another cell will automatically post the changes and
>I
>>don't want that. Is there a way to prevent this ??

>>TIA

>>Hendrik

>>|************** Wageningen Agricultural University. ************|
>>|  Department of Information Management and Datacommunication   |
>>-----------------------------------------------------------------
>>Hendrik Klompmaker: Senior Technologist
>>Internet          : Hendrik.Klompma...@Net.IenD.Wau.Nl
>>X400              : c=nl;a=400net;p=surf;o=wau;ou1=IenD
>>                  : ou2=Net;s=klompmaker;gi=hendrik
>>Phone             : +31 (0)317-484059
>>Fax               : +31 (0)317-482970
>>Snail             : Dreijenplein 2
>>                    6703 HB Wageningen / The Netherlands
>>-----------------------------------------------------------------

|************** Wageningen Agricultural University. ************|
|  Department of Information Management and Datacommunication   |
-----------------------------------------------------------------
Hendrik Klompmaker: Senior Technologist
Internet          : Hendrik.Klompma...@Net.IenD.Wau.Nl
X400              : c=nl;a=400net;p=surf;o=wau;ou1=IenD
                  : ou2=Net;s=klompmaker;gi=hendrik
Phone             : +31 (0)317-484059
Fax               : +31 (0)317-482970
Snail             : Dreijenplein 2
                    6703 HB Wageningen / The Netherlands
-----------------------------------------------------------------

Re:DBGrid. Prevent Post when moving cursur to another row. How ???


Quote
>Hendrick:
>Boy have you touched a nerve!  I have the exact same problem with the new
>ctrl grid in d2/3.  As a temporary fix, I modified the original code to
>not allow this type of autopost.  When I get some time, I'm going to try
>to make a descendant that overrides the autopost.  Failing that, I may
>just use the altered source under another name.

>I don't want to do it that way if I can avoid it.  There seems to be a
>major rewrite of the ctrlgrid between d2 & d3 and I don't want to always
>have to manually maintain my versions if I can avoid it.

I've been trying to do the same thing.. if you set an onpost method
then you can abort it (I assume you like me want to prompt the user to
save changes), but then it doesn't move of the cell.. so I'm thinking
descend/modify and add a okpost event handler at the start of the post
method, this way there's no exception so the thing that called post
(ie moving off the cell) still works.

Re:DBGrid. Prevent Post when moving cursur to another row. How ???


You might want to try cached updates.  In the OnUpdateRecord event of
the dataset, you can determine at the time the data is
applied(committed) whether to keep or toss certain rows based on the
value(s) of one or more columns.

Quote
Hendrik Klompmaker wrote:

> Hi,

> This might be a faq but I haven't been able to find anything to solve
> my
> problem.
> I have a DBGrid with a DBNavigator. I want editing only be possible
> through
> DBNavigator. Most of it works except the biggest problem. When in Edit
> state,
> moving the cursor to another cell will automatically post the changes
> and I
> don't want that. Is there a way to prevent this ??

> TIA

> Hendrik

Other Threads