?
Solved

Skipping TDBGrid cells on condition

Posted on 2003-02-26
4
Medium Priority
?
347 Views
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
-ROD
0
Comment
Question by:rodski
[X]
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
4 Comments
 

Accepted Solution

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

I tried your question with this procedure:

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

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 ?
0
 

Expert Comment

by:CleanupPing
ID: 9317048
rodski:
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 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 10

Expert Comment

by:kacor
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.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

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

kacor
EE Cleanup Volunteer
0

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