Solved

Listbox problem

Posted on 1997-09-30
6
163 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
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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

830 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