Solved

Delphi 7 :: TListView on ItemSelect mouse drag cursor

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

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

Title # Comments Views Activity
add combobox item based on numbers 9 154
Send message from delphi to whatsapp, is it possible? 3 1,698
Firemonkey webbrowser scrollbars ? 1 50
Wincontrol not (correctly) drawn 15 42
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…
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…
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 …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

821 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