Solved

Listbox problem

Posted on 1997-09-30
6
167 Views
Last Modified: 2011-10-03
I have an application which uses a listbox to view certain criteria which matches the item selected.  When I click on an item, it will read a database and display that information.

However, I am also trying to drag from that listbox into another one.  This is where the problem starts.  I dont want the database lookup to happen when I am dragging, but unfortunately, the OnMouseDown and OnClick are the same to the extent is is trying to do the D&D at the same time as the lookup.

I have tried activating the lookup using OnMouseUp, but for some reason, the Drag and Drop routines take over that function as well.

Is there a way I can do this?????

Any help would be appreciated.

Stu
0
Comment
Question by:Stuart_Johnson
[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
6 Comments
 
LVL 1

Expert Comment

by:sassas081597
ID: 1346657
Hi!
Why not to look your Database on DblClick event?
0
 
LVL 6

Author Comment

by:Stuart_Johnson
ID: 1346658
Im not using a TDBListBox.  Its just a TListBox.  

Thanks anyway.

Stu

0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1346659
Well, had the same problem and still have it! Tried everything I could think of, but no, nothing helped. I worked around the problem. I used for one purpose the right button and for the D&D the left button.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Accepted Solution

by:
ClausChristianUde earned 50 total points
ID: 1346660
Yes, it maybe not a very good way, but it will work:

1. Set a variable AreYouDragging := FALSE
2. Wait 500msec before you start searching the database. Do it by:

    Procedure Delay(ms : LongInt);
    Var
      TickCount : LongInt;
      M         : TMsg;
    Begin
      TickCount := GetTickCount;
      While GetTickCount - TickCount < ms do
        If PeekMessage(M,0,0,0,pm_Remove) then
          Begin
            TranslateMessage(M);
            DispatchMessage(M);
          End;
    End;

2. If drag and drop starts set AreYouDragging := TRUE

3. if the AreYouDragging is FALSE you search the database


0
 
LVL 6

Author Comment

by:Stuart_Johnson
ID: 1346661
I actually found out how to do it, but as EE doesnt have a way of begin able to cancel a question, I had to leave it open.

FYI, I used If TARGET = NIL then {do db lookup}

This seems to be the easiest and cleanest way of doing it - and it works like a charm!!!

Thanks for you help anyway.

Stu
0
 
LVL 6

Author Comment

by:Stuart_Johnson
ID: 1346662
I actually found out how to do it, but as EE doesnt have a way of begin able to cancel a question, I had to leave it open.

FYI, I used If TARGET = NIL then {do db lookup}

This seems to be the easiest and cleanest way of doing it - and it works like a charm!!!

Thanks for you help anyway.

Stu
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month4 days, 9 hours left to enroll

635 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