Skipping TDBGrid cells on condition

Posted on 2003-02-26
Medium Priority
Last Modified: 2012-05-04
Hi there,

I have a TDBGrid that connects to a table in a database.  The cells in the grid are editable and I have a column in this grid that is called 'Weight Units' which connects to the underlying field in the database and another column before it in the grid called Quantity.

I also have a drop-down TDBLookUpComboBox that looks-up a table in the DB and displays all the weight units e.g. KG, lb, Tons etc.

What I want is that if I enter a quantity in the cell under the Quantity column then the TDBLookUpComboBox will pop-up on the OnColExit event so that the user can choose a quantity.  However, if the user enters '0' in the Quantity column then I don't want the TDBLookUpComboBox to pop up and simply skip to the next line in the grid for input.  I have associated the TDBLookUpComboBox to the grid column 'Weight Units' and set both it and the datasource to be readonly if it detects that the quantity field is 0.  I have also set the tabstop on the TDBLookUpComboBox to be false when this is the case.

However, I am still finding that the cursor stops on the TDBLookUpComboBox in the 'Weight Units' column even when the quantity field is 0.

Can anyone help or provide tips?

Many thanks
Question by:rodski
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

da-vinci earned 120 total points
ID: 8059303
Hello rodski

I tried your question with this procedure:

procedure TForm1.DBGrid1ColExit(Sender: TObject);
    if (DBGrid1.Fields[0].AsInteger <> 0) and (DBGrid1.SelectedIndex=0) then

Where field 0 is the 'quantity' field and field 1 is the 'weight units' field. I didn't set the readonly to True or anything else.

In my case the cursor didnt stop at the weight units column.
Is this what you mean ?

Expert Comment

ID: 9317048
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.
LVL 10

Expert Comment

ID: 9981572
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:
       to accept da-vinci's answer
Please leave any comments here within the next seven days.


Some days and here is the Christmas Time. I wish good luck and good health for you all and for your loved ones

EE Cleanup Volunteer

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

801 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