Solved

Delphi 7 :: TListView on ItemSelect mouse drag cursor

Posted on 2006-11-04
5
892 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

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

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

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

20 Experts available now in Live!

Get 1:1 Help Now