Solved

Delphi 7 :: TListView on ItemSelect mouse drag cursor

Posted on 2006-11-04
5
891 Views
Last Modified: 2012-08-14
Dear Friends,

I have a TListView which have several items in.
OnSelectItem event I make calls to a procedure which in return calls 2 other procedures
to run the relevant process for the selected item.

The TListView.DragMode = dmAutomatic.
I do call Application.ProcessMessages where any loops etc occur.
The problem is when selecting an Item and the process are a bit lengthy (not much) then when
releasing the mouse (normal single click) the cursor turns to the drag&drop cursor. Although I did not press and hold the mouse.

When I press and hold the mouse button down for while and then releasing then the problem
do not occur.


Any suggestion on how to solve this?

Thanks!
0
Comment
Question by:Marius0188
5 Comments
 
LVL 15

Assisted Solution

by:mikelittlewood
mikelittlewood earned 50 total points
ID: 17876440
Have you tried just putting a processmessages first in the OnSelectItem to see if it will clear it.
0
 

Author Comment

by:Marius0188
ID: 17876620
Yes I have done that as well.

And all the calling Procedures as well.


Why does  Delphi's components sometimes seem to be so difficult for a simple
instruction like this? :) (Just feel like mowning today).

0
 
LVL 28

Accepted Solution

by:
TName earned 100 total points
ID: 17878203
Just a workaround, but you could try to move the code into the MouseUp event. Something like this:

procedure TForm1.ListView1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
   if ListView1.Selected<>nil then
     if ListView1.GetItemAt(X,Y)=ListView1.Selected then begin

      //Do stuff with ListView1.Selected

     end;
end;
0
 

Author Comment

by:Marius0188
ID: 17886537
Is there not a way I can fix the problem rather?
Dont wish to move my code to OnMouseUp as first option.

Any other suggestion?
0
 
LVL 2

Assisted Solution

by:WallaceAdrian
WallaceAdrian earned 100 total points
ID: 17912977
You could try changing the drag mode youreslf after your procedure has finished executing

eg

procedure TForm1.ListView1SelectItem(Sender: TObject; Item: TListItem;
  Selected: Boolean);
begin
  ListView1.DragMode := dmManual;
  callsleep;  // your ptocedure here
  ListView1.DragMode := dmAutomatic;
end;
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

707 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

20 Experts available now in Live!

Get 1:1 Help Now