Solved

Listbox problem

Posted on 1997-09-30
6
166 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Create Database on Android via Delphi dbExpress 3 143
HTML text in the body of an email (delphi code) 12 258
Reconfigure Delphi Install? 2 77
Wincontrol not (correctly) drawn 15 59
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

738 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