Solved

Listbox problem

Posted on 1997-09-30
6
155 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

867 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now